SimplePanda SimplePanda - 3 months ago 7x
MySQL Question

Is data returned from a MySQL Connector/C query not in native C data format?

If I execute a query against the MySQL Connector/C library the data I'm getting back all appears to be in straight

char *
format, including numerical data types.

For example, if I execute a query that returns 4 columns, all of which are
in MySQL, rather than getting back 4 bytes worth of data (each byte representing a single column row value), I'm actually getting back 4 ASCII encoded character bytes, where
is actually a byte with the numeric value
in it (ASCII for

Is this accurate or am I just missing something complete?

Do I really need to then
that returned byte into an
in my code or is there a mechanism to get the native C data types out of the MySQL client directly?

I guess my real question is: is the
structure converting that data to ASCII encoded representations in a way that can be bypassed by my application code?


I believe the data is sent on the wire as text in the MySQL protocol (I just confirmed this with Wireshark). So that means mysql_store_result() is not converting the data, it's just simply passing the data on as it was received. MySQL actually sends integers as text. I agree this always seemed like an odd design to me as well.