Add element reference operator #[] to Mysql2::Result using mysql_data_seek - #345
Open
sodabrew wants to merge 6 commits into
Open
Add element reference operator #[] to Mysql2::Result using mysql_data_seek#345sodabrew wants to merge 6 commits into
sodabrew wants to merge 6 commits into
Conversation
Collaborator
Author
|
The fourth changeset builds on the #[] changeset, adding support for: result = @client.query "SELECT 1 AS col UNION SELECT 2 AS col"
p result[1, 0]
[]
p result[1, 1]
[{"col" => 2}]
p result[-2, 2]
[{"col" => 1}, {"col" => 2}]
p result[1, {:symbolize_keys => true}]
{:col => 2}
p result[1, 1, {:symbolize_keys => true}]
[{:col => 2}]Now that I'm returning an array, I should probably support cacheRows, which means the code in result#[] is going to look a lot like result#each. More refactoring! |
sodabrew
force-pushed
the
mysql_data_seek
branch
from
February 26, 2015 23:54
288c3d7 to
5f0f545
Compare
Collaborator
Author
|
Two years later - rebased yo! |
sodabrew
force-pushed
the
mysql_data_seek
branch
2 times, most recently
from
June 11, 2015 22:08
8262aa4 to
1eea3e2
Compare
… Mysql2::Result using mysql_data_seek.
…opts hash}] and [offset, count, {opts hash}].
Contributor
There was a problem hiding this comment.
this preamble could be implemented in ruby and would be much easier to read - why not do that?
Collaborator
Author
There was a problem hiding this comment.
I actually moved this further down the chain so that the same code is used by the variants of [] and each.
sodabrew
force-pushed
the
mysql_data_seek
branch
2 times, most recently
from
June 12, 2015 03:56
c1dcead to
b77f237
Compare
sodabrew
force-pushed
the
mysql_data_seek
branch
from
June 12, 2015 04:22
b77f237 to
6fce37c
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #130 mysql_data_seek is wrapped behind the element reference operator #[]. You can jump directly to a particular result row:
Open for comment!