Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add Client#query_info #349

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

libc commented Jan 23, 2013

Hey,

It's basically a direct mapping to mysql_info. I didn't use #info, because #info is taken by mysql_client_info.

I'm using this function to get the number of skipped rows after LOAD DATA INFILE. I didn't find another way to obtain that counter. So it could be useful for somebody else.

Thanks

Add Client#query_info that calls mysql_info.
The function is really useful if you want to retrieve the result of the LOAD
DATA INFILE command.
Collaborator

sodabrew commented Jan 24, 2013

Nice! Counter-proposal: add a query option that automatically runs mysql_info after the execute, and makes the info part of the result set. Counter-proposal 2: always run mysql_info, parse the output, and make it part of the result set. I don't really like that you would have to parse the string in your own code, if we can do it faster in C for you. I wonder how this is implemented in the client library? Maybe we can grab the underlying numbers in a more native manner.

Contributor

libc commented Jan 24, 2013

Isn't calling it after each command a bit wasteful? I don't really see people using this information most of the time. I use it only for one specific SQL command.

I can add parsing of the result if necessary, that's not too difficult.

Collaborator

sodabrew commented Jan 24, 2013

It looks like mysql_info returns a statically allocated string that is always populated after a query, so the cost should be reasonably low. (Hopefully I'm reading from the right location in mysql code...)

http://bazaar.launchpad.net/~mysql/mysql-server/5.5/view/head:/libmysql/libmysql.c#L1059

Collaborator

sodabrew commented Jul 10, 2013

Rebased as #395

@sodabrew sodabrew closed this Jul 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment