Article View: borland.public.cppbuilder.database.ado
Article #5539Alternatives to BatchUpdates in ADO?
From: Piero Salandin
Date: Mon, 09 Apr 2001 11:48
Date: Mon, 09 Apr 2001 11:48
50 lines
2872 bytes
2872 bytes
I need to have a safe "transactional system" on a RDBMS (say SQL Server)
using ADO. The use of ADO is because _probabily_ it is better than BDE and
_probabily_ BDE will be excluded from future releases of Borland products.
I thought of a way of doing this with BatchUpdates, by issuing explicit
transaction commands on the DB. Lest's make an example and say we are
inserting or updating a simple Order with some Items ordered. That is how it
should go:
1.1 myErrors = Begin Transaction;
1.2 if myError<>0 break and alert etc etc.. and stop the whole process
2.1 myError = 0
2.2 myError += {Insert or update the record on the Orders table}
2.3 myError += {Insert and/or update the rows of the Ordered Items on the
ItemOrders table}
3. if (myError==0) Commit Transaction else Rollback Transaction;
4. Alert about all the errors
The step 2 is crucial, and it involves all the related tables (or DataSets)
in a Logical Unit of Works, so to assure that all the modifications or none
of them are issued.
The operations from 1. to 3. have to be as quick as possible, so I thought
that a BatchUpdate system may help, as in that case only when applying
updates by way of UpdateBatch() the data are really written to the DB, and
so they can be easily controlled by a begin/end transaction block.
First of all: is this correct? What kind of (known) problems will arise? Any
hint on performances?
Second: in BDE there is an OnUpdateError event that should arise on errors
during the update process.
I did not find anything similar in ADO, and I'm wondering how to overcome
the problem, how to get that myErrors value.
Third: are there other similar architecture you would suggest to achieve the
same goal? I'm not particularly in love neither with ADO, nor with this
Transaction Control. I would like to avoid MTS and other stuff, remaining on
a C/S basis by now.
SeeYa
Piero
--
Ing. Piero Salandin
piero.salandin@libero.it
Technical Details
Message-ID:
<3ad1a324_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,b73f731d77be7033,start X-Google-Attributes: gid10698b,public X-Google-Thread: f5cad,b73f731d77be7033,start X-Google-Attributes: gidf5cad,public X-Google-ArrivalTime: 2001-04-09 05:04:07 PST From: "Piero Salandin" <piero.salandin@libero.it> Newsgroups: borland.public.cppbuilder.database.ado,borland.public.delphi.database.ado Subject: Alternatives to BatchUpdates in ADO? Date: Mon, 9 Apr 2001 13:48:41 +0200 Lines: 56 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 151.25.9.136 Message-ID: <3ad1a324_1@dnews> X-Trace: dnews 986817316 151.25.9.136 (9 Apr 2001 04:55:16 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews