MySQL Create tables without commiting current transaction

Posted by user276648 on Stack Overflow See other posts from Stack Overflow or by user276648
Published on 2010-06-02T07:14:16Z Indexed on 2010/06/02 7:23 UTC
Read the original article Hit count: 326

Filed under:
|
|
|
|

I'd like my program to be able to install plugins, and rollback all the changes made if an error occurs. So I create a transaction that keeps all the things that were added while installing the plugin. The problem is that the plugin may want to create tables, and doing so automatically commits the current transaction in MySQL.

See Statements That Cause an Implicit Commit on MySQL web site.

Any idea on how I could do it?

I thought of using temporary tables as they are not automatically commited, unless they are using too much memory, but it looks like temporary tables cannot be rolled back anyway (and I haven't found a way to convert them to permanent tables).

I just found out about "save points" (http://dev.mysql.com/doc/refman/5.1/en/savepoint.html), but I don't really understand how/when it should be used nor if it can help me achieve what I want.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about table