MySQL Forums
Forum List  »  InnoDB

lock and transaction
Posted by: gianpaolo fabiani
Date: June 29, 2005 04:25AM

I have a db with this table

CREATE TABLE `customers` (
`idcustomer` int(10) unsigned NOT NULL auto_increment,
`Customer Name` varchar(45) NOT NULL default '',
PRIMARY KEY (`idcustomer`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `customers` (`idcustomer`, `Customer Name`) VALUES (NULL, 'OLDCustomer');

If I execute this operation

START TRANSACTION;
lock table customers WRITE;
UPDATE `customers` SET `Customer Name`='MODIFYcustomer' WHERE `idcustomer`=1;
unlock table;
ROLLBACK;

SELECT * FROM `customers`;
'idcustomer','Customer Name'
'1','MODIFYcustomer'

The record changes. Is it correct? Or is it a bug?


If I execute the same operation with a different order the record doesen't change

lock table customers WRITE;
START TRANSACTION;
UPDATE `customers` SET `Customer Name`='AAAAAcustomer' WHERE `idcustomer`=1;
ROLLBACK;
unlock table;

SELECT * FROM `customers`;
'idcustomer','Customer Name'
'1','MODIFYcustomer'


Thanks
Gianpaolo

Options: ReplyQuote


Subject
Views
Written By
Posted
lock and transaction
3401
June 29, 2005 04:25AM
1927
July 03, 2005 11:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.