Reputation: 31
In the php script if my query is incorrect, exit the program with a die. My question is, if they are in the middle of a transaction, that it will end? Will run an implicit ROLLBACK?
mysql_query('BEGIN'); mysql_query('UPDATE ...'); mysql_close();
in this case behaves like mysql? and using persistent connections? (http://www.php.net/manual/en/function.mysql-pconnect.php#33994)
Upvotes: 3
Views: 166
Reputation: 86386
It's depend on how you are performing transaction from PHP side.
If you are using simple mysql_query
function to run each transaction statement separately and if any query fails the transaction never rollback.
If you are creating transaction in stored procedure and calling that stored procedure from PHP. The changes will be rolled back if any query fails in transaction.
Upvotes: 1
Reputation: 206689
The MySQL engine will rollback transactions when errors occur, or if the session closes for any reason before commit. Only committed transactions are persisted. See the transaction documentation for more details.
Upvotes: 1
Reputation: 54022
if your QUERY is wrong and not executed then nothing will be changed in your tables..dont worry
Upvotes: 0