Hello,
I read in the book High Performance MySQL, Second Edition that innodb transactions are reliable but its not the same case on my side. On my website i am sending three sql commands to mysql server.
2 Inserts, and one update. Innodb skip the update sql (MOST of the time, NOT all the time) and commits the transaction.
I am using set autocommit = 1 and here are mysql statements
> Begin
Q1: INSERT INTO files (`file_title`, 'file_date') VALUES('new file', NOW());
> $id = mysql_insert_id();
Q2: UPDATE user_info SET `total_media`=`total_media`+1, `file_size`=$file_size WHERE id=13;
Q3: INSERT INTO keywords (file_id, keyword) VALUES ($id, 'keyword')
if(mysql_query->query($q1) && mysql_query($q2) && mysql_query($q3)) {
> COMMIT;
}
else {
> ROLLBACK;
}
Above code is just for understanding and all numeric fields are Integers.
Please help me on this.
Thanks,
Moazam
I read in the book High Performance MySQL, Second Edition that innodb transactions are reliable but its not the same case on my side. On my website i am sending three sql commands to mysql server.
2 Inserts, and one update. Innodb skip the update sql (MOST of the time, NOT all the time) and commits the transaction.
I am using set autocommit = 1 and here are mysql statements
> Begin
Q1: INSERT INTO files (`file_title`, 'file_date') VALUES('new file', NOW());
> $id = mysql_insert_id();
Q2: UPDATE user_info SET `total_media`=`total_media`+1, `file_size`=$file_size WHERE id=13;
Q3: INSERT INTO keywords (file_id, keyword) VALUES ($id, 'keyword')
if(mysql_query->query($q1) && mysql_query($q2) && mysql_query($q3)) {
> COMMIT;
}
else {
> ROLLBACK;
}
Above code is just for understanding and all numeric fields are Integers.
Please help me on this.
Thanks,
Moazam
Comment