I am writing a C ++ application that uses the MySQL C> API to connect to a database. The MySQL server version is 5.6.19-log.
I need to run multiple SQL UPDATE , INSERT and DELETE in the same transaction to make sure that all changes or changes are not applied.
I found in the docs functions mysql_commit() and mysql_rollback() that complete the transaction (commit it or roll it back), but I can not find the corresponding function in which it starts the transaction.
Is there such a function? Am I missing something?
I run the UPDATE , INSERT and DELETE using mysql_real_query() .
I assume that I should start the transaction by running the START TRANSACTION SQL statement using the same mysql_real_query() function. Then I would have to complete the transaction by executing the COMMIT SQL statement using the same mysql_real_query() function.
But then, what is the point of having the mysql_commit() and mysql_rollback() functions allocated in the API?
source share