Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> MySQL transakcje, rollback autoincrement
Thuunder
post
Post #1





Grupa: Zarejestrowani
Postów: 234
Pomógł: 1
Dołączył: 29.10.2004

Ostrzeżenie: (0%)
-----


Witam,

Mam problem z transakcją, ponieważ jeśli wszystko jest ok to commit i rekord się dodaje. Gorzej jeśli coś się nie powiedzie i wykonuję rollback - wtedy autoincrement jakiegoś pola zwiększa mi się o 1, a nie tak jak powinien pozostać nieruszony.
Co z tym zrobić?

Ten post edytował Thuunder 23.10.2009, 10:52:08
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




http://dev.mysql.com/doc/refman/5.1/en/inn...t-handling.html
Cytat
In all lock modes (0, 1, and 2), if a transaction that generated auto-increment values rolls back, those auto-increment values are “lost.” Once a value is generated for an auto-increment column, it cannot be rolled back, whether or not the “INSERT-like” statement is completed, and whether or not the containing transaction is rolled back. Such lost values are not reused. Thus, there may be gaps in the values stored in an AUTO_INCREMENT column of a table.


To kiepsko masz napisaną aplikacje ze tak czesto ci sie zdarzają rollbacki ze widzisz problem w tych dziurach (IMG:style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 04:26