-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include field names when using query
.
#148
Comments
|
Not the same as mysql2, but
to get hashes. |
Very true, and that's a great use of We use this in quite a few places so it would mean changing a lot of lines, minor as it is. Is there a desire to have Let me know. And thanks again! |
Trilogy isn't a intended as a 1:1 drop in replacement for mysql2, though it is similar due to shared authorship and consumers. I don't think it's a good idea for us to change the behaviour of |
Oh right, I totally forgot about |
Totally fair. I'll give that a shot and go from there. Thanks for all your work on this. |
Just wanted to say, And to get a single expected row, I ended up using I didn't know Many thanks! |
Our documentation is limited at the moment, but we do have trilogy/contrib/ruby/README.md Line 33 in 3c3a386
trilogy/contrib/ruby/lib/trilogy/result.rb Lines 9 to 25 in 3c3a386
|
Yup, perfect. https://github.com/trilogy-libraries/trilogy/tree/main/contrib/ruby#usage That would have been super helpful. You even callout that
Thanks again. |
Something we noticed after upgrading from
mysql2
totrilogy
was the lack of field names when running aquery
manually.Here is a simple example of the differences:
mysql2
trilogy
Differences
A few differences to point out:
In order to establish a database connection and run a
query
, you need to create a newTrilogy
instance and then useselect_db
orchange_db
and provide the database name again, otherwise, you get a "No database selected" error.mysql2
returns aHash
whiletrilogy
returns anArray
from thequery
method.In an otherwise incredible drop-in replacement, this prevents the usage of fetching the row values based on the column names, like this:
Which worked very well on
mysql2
.We're reverting back to
mysql2
in the meantime but thought I would post it here to get your input because this is (so far) the only thing preventing us from moving forward withtrilogy
.Many thanks!
Joshua
The text was updated successfully, but these errors were encountered: