[Gllug] Perl querying SQL server 7

Jackson, Harry HJackson at colt-telecom.com
Tue Aug 21 14:08:38 UTC 2001


> -----Original Message-----
> From: Dean [mailto:dean.wilson3 at virgin.net]
on't have the feature. 
> 
> If the database doesn't support transactions does it bomb or 
> just commit?


As far as I am aware the following would be a typical action for a database
that does not support transactions

LOCK table_name
UPDATE table_name 
UNLOCK table_name 

As you can see this is effectively got a permanent commit on the table in
question which is not good if your server loses a connection or power or one
of the disks on the raid goes and the table is rebuilt elsewhere. A lot of
things can occur that can cause you a headache. This does not look to bad
until you see what would happen if you had 4 tables being modified to hold
someone's shopping cart details

LOCK table_name
LOCK table_name2
LOCK table_name3
LOCK table_name4
UPDATE table_name
UPDATE table_name2
UPDATE table_name3
UPDATE table_name4
UNLOCK table_name
UNLOCK table_name2
UNLOCK table_name3
UNLOCK table_name4

Imagine what happens if the server fails after UPDATE table_name2. You end
up with an incomplete action and dodgy data.



On the other hand we can see the actions if transactions are supported. For
those of you who do not know unless the database is sent a commit all
actions from the last Commit will not be seen in the database and will be
lost. This does not sound good but it is very handy


BEGIN 
UPDATE table_name
UPDATE table_name2
UPDATE table_name3
UPDATE table_name4
UPDATE table_name5
UPDATE table_name6
UPDATE table_name7
UPDATE table_name8
COMMIT  

If the server drops here before the commit then there is no dirty data and
you just rerun your SQL or carry out your action again. This can mean you
could have a hundred tables modified during 1 transaction and they will not
be corrupted during failure.

Harry
I am sure there are a few people who could add to this (rcebu) or more than
likely correct it.






**********************************************************************
COLT Telecommunications
Registered in England No. 2452736
Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ
Tel. 020 7390 3900

This message is subject to and does not create or vary any contractual
relationship between COLT Telecommunications, its subsidiaries or 
affiliates ("COLT") and you. Internet communications are not secure
and therefore COLT does not accept legal responsibility for the
contents of this message.  Any view or opinions expressed are those of
the author. The message is intended for the addressee only and its
contents and any attached files are strictly confidential. If you have
received it in error, please telephone the number above. Thank you.


**********************************************************************

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list