The page at https://dev.mysql.com/doc/c-api/9.2/en/mysql-use-result.html states:
When using
mysql_use_result()
, you must executemysql_fetch_row()
until aNULL
value is returned, otherwise, the unfetched rows are returned as part of the result set for your next query. The C API gives the errorCommands out of sync; you can't run this command now
if you forget to do this!
However I plan to use another call to MYSQL on another thread using different MYSQL result set.
Will this work properly? Documentation does not say anything in this regards...
No, you cannot use the same connection on two threads when using mysql_use_result
, quoting Writing C API Threaded Client Programs
To use
mysql_use_result()
, you must ensure that no other thread uses the same connection until the result set is closed. However, it really is best for threaded clients that share the same connection to usemysql_store_result()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With