and the image table is dropped, even if i use the rollback method...
Perhaps it does this because my table is not TYPE=InnoDB and transaction works only with InnoDB engine.
i specify this type bu creating my image table like this
barton_c: Autocommit is off by default in MySQLdb (as mandated by PEP 249).
gregastrophysic: Don't expect data definition statements (like ALTER or DROP) to be transactional. They just don't make much sense in a transactional context (since transactions are generally about rows and data, not meta-data). That said, you answer is here:
Hello everybody,
I'm trying to use transactions through MySQLDB
Could someone show me how to?
An example of my script:
!/usr/bin/env python
import MySQLdb,blabla....
connectionObject = MySQLdb.connect(blabla....)
c = connectionObject.cursor();
c.execute("""drop table image""");
connectionObject.rollback();
connectionObject.close();
and the image table is dropped, even if i use the rollback method...
Perhaps it does this because my table is not TYPE=InnoDB and transaction works only with InnoDB engine.
i specify this type bu creating my image table like this
CREATE TABLE image (
blabla.....
blabla.....
blabla.....
blabla.....
)TYPE=InnoDB;
Is it the right thing to do to make InnoDB table?
Please Help me!
barton_c: Autocommit is off by default in MySQLdb (as mandated by PEP 249).
gregastrophysic: Don't expect data definition statements (like ALTER or DROP) to be transactional. They just don't make much sense in a transactional context (since transactions are generally about rows and data, not meta-data). That said, you answer is here:
http://dev.mysql.com/doc/refman/5.0/en/drop-table.html
DROP TABLE commits the current active transaction unless you're dealing with temporary tables.
c.execute("""set autocommit = 0""") before anything else.