MySQL Forums
Forum List  »  Newbie

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

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
Written By
Posted
lock and transaction
June 29, 2005 04:23AM
June 29, 2005 10:12AM
June 29, 2005 11:53AM
June 29, 2005 11:55AM


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.