forked from jeremyevans/sequel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow splitting of multiple result sets into separate arrays when usi…
…ng multiple statements in a single query in the native MySQL adapter This allows you to use Dataset#split_multiple_result_sets when using the native MySQL adapter to have each yield arrays of rows, one per statement, instead of yielding hashes for all result sets. This makes it possible to determine which statements yielded which result sets. Because of the way Sequel is architected, you cannot graph a dataset that splits multiple statements. There are no plans to rearchitect Sequel to accomodate that. Having each yield arrays of hashes instead of hashes breaks numerous internal assumptions held by Sequel. For example, row_proc assigned to split_multiple_result_sets datasets have to be recoded to accept arrays of hashes instead of plain hashes. Note that when you split a multiple result set dataset, it will modify an existing row_proc for you, so this particular issue won't be a problem. However, you should be aware that having each returning arrays instead of hash may cause unexpected breakage elsewhere. While here, fix another commands out of sync bug that occured when multiple statements. Before, if you executed a multiple result set query and returned before getting all of the results (say by using Dataset#first), the next query would get a commands out of sync message. Now, an ensure block inside of Database#execute will get all remaining result sets so that should no longer happen. This was found while writing tests for the split multiple result set code.
- Loading branch information
1 parent
d04684c
commit f15c1f9
Showing
3 changed files
with
96 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters