|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I have a table lets say TblHD { id : int auto_increment primary_key; codeno : varchar(12) ; // unique ; ... other fields .... } id is autoincrement and i used it for creating primary key. codeno is like id, but it is for user to identify the transaction number (it is sequence in number format) my question is, if i have id, should i have codeno or i just need id ? what if in the transaction happens like this ... user1 : entry a transaction at the same time with user2 and user1 get first id (lets say '1') and user2 get id (lets say '2'). But in the middle, trigger for user 1 was raised an exception and the transacation was canceled. is the user2 get id 2 or he got 1 ? is mysql auto increment behave the same thing like in oracle sequences ? can autoincrement rolledback ? afaik in oracle the sequences wont rolled back. how about in mysql. tx |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Adwin Wijaya:
> is mysql auto increment behave the same thing like in oracle > sequences ? > can autoincrement rolledback ? No. Once your application issued an INSERT query, it may get the autoincremented primary key returned and anticipate on that. A rollback of the autoincremented value would have disastrous consequences for the remainder of the functionality. -- Erick |
|
![]() |
| Outils de la discussion | |
|
|