Andrij Korud writes:> Hey, I just found that if I "BEGIN", making a lot of inserts (1000) and on> 1001 insert I get an
error(for example "duplicate key") ALL prev 1000> insertes I LOST.> Give me please author of this %$%$^&%# idea!!! It's
reallySTUPID.
Actually, that's the way it's supposed to work. Most modern
relational databases support what are called transactions. A
transaction is an indivisible unit of work for the database engine.
By starting a transaction (using the 'BEGIN') you are telling the
database engine that you want it to make the updates if and only if
_all_ of the updates can succeed. If any updates that will fail the
database engine will make sure that none of the updates take place.
Transactions come in really handy if we have updates on a set of mutually
dependent tables. Frequently we don't want to update any of the
tables unless we can sucdeed in updating all of the tables.
If you have a set of updates that aren't mutually dependent, just use
a 'COMMIT TRANSACTION' between each update.
--
=======================================================================Life is short. | Craig
Spannring Bike hard, ski fast. |
Craig.Spannring@aedinc.net--------------------------------+------------------------------------Anysufficiently horrible
technologyis indistinguishable from Perl.
=======================================================================