Why doesn't the RedBean transaction functions work?

I just noticed that when importing some data into a MySQL database using PHP and RedBean (and transactions), I could see how many rows grow during import. To confirm my suspicion, I changed R::commit() to R::rollback() at the end of the import function and tried to import. Indeed, the data was imported and permanent, although I called rollback.

I have no idea why the transaction is not doing this work, and I don’t know where to start looking, therefore this question. This is where part of the function is imported . Let me point out that besides a transaction that does not work , the import function works fine, so there is no need to open it.

Thanks for any hypotheses.

+4
source share
1 answer

Aha! I get it. In an effort to prove @furier's error, I looked at the RedBean transaction documentation and came across a very useful note:

Many databases are automatically committed after changing schemas, so make sure you check your transactions after R::freeze(true); !

So, to summarize, some databases can auto-comment if you have not frozen RedBean using R::freeze(true); violating all transaction actions in your application

+9
source

Source: https://habr.com/ru/post/1415586/


All Articles