Expose db attribute of MYSQL client struct#1245
Conversation
|
I'll admit I'm not very familiar with the MySQL client libraries or Ruby extensions, so noob mistakes are a strong possibility here. I started working on this when I saw #1092 didn't work the way I expected. The call to I dug into the client code on the MySQL side and found this: It's updating the Hence this PR to expose the Now, does the MySQL client library guarantee that it keeps this |
|
Hi @sodabrew. This is a friendly reminder of PR. You mentioned in an earlier iteration that you'd be willing to review. If you can take a look at this one (now with tests!) I'd appreciate it. Thanks! |
|
Thanks for the nudge! |
|
Catching up on very old PRs! This looks OK, but it should be named Lines 168 to 169 in 58f8d00 |
Adds an accessor method that returns the current value of the `MSYQL` client struct's `db` attribute. The `MYSQL` client struct includes a field `char *db`. When the `session_track_schema` setting is enabled, this field will be updated using information from server-provided "OK" packets, keeping it in sync as the client switches between databases.
9cfde46 to
1ffe844
Compare
|
Hi @sodabrew, Sorry I'm late to notice your comment. @stefansundin reminded me that this exists and provided a patch that implements your suggestion. I've updated the PR accordingly. |
Adds an accessor method that returns the current value of the
MSYQLclient struct's
dbattribute.The
MYSQLclient struct includes a fieldchar *db. When thesession_track_schemasetting is enabled, this field will be updatedusing information from server-provided "OK" packets, keeping it in sync
as the client switches between databases.