i'm using web2py dal with mysqldb adapter to connect to mysql server.
my question:
- why does it need a single "commit" without leading "begin transaction" after "set autocommit=0"
- does "select" statement begin a transaction if autocommit=0?
server info: innodb engine autocommit=1 (default value) tx_isolation=repeatable-read (default value)
general_log:
100356 10:00:00 123456 Connect [email protected] on dummydb
123456 Query SET NAMES 'utf8'
123456 Query SET AUTOCOMMIT = 0
123456 Query COMMIT
123456 Query SET FOREIGN_KEY_CHECKS=1
123456 Query SET sql_mode='NO_BACKSLASH_ESCAPES'
Uh ... because you disabled auto-commit????
Here's a good explanation:
In other words:
"transactions" aren't necessarily only about "executing multiple statements as one atomic entity"
autocommit gives you the "illusion" of one statement == 1 transaction
In fact, "automcommit off" gives you "one statement == 0 transactions"
From the same link: