Article View: borland.public.cppbuilder.database.multi-tier
Article #495Re: Questions on ApplyUpdates, CommitUpdates
From: Harold Howe (TeamB)
Date: Fri, 07 Sep 2001 15:11
Date: Fri, 07 Sep 2001 15:11
52 lines
3452 bytes
3452 bytes
> >Make sure you have CachedUpdates = true, and in the AfterPost event do > >ApplyUpdates() and CommitUpdates(). > > This is a bit unclear. From the help files, I gather that > ApplyUpdates() writes the cache out to somewhere, and CommitUpdates() > is misnamed, and only clears the cache. Keep in mind that CommitUpdates will actually retry any updates that fail or were skipped. I never realized this until I actually saw it in action. This may be ok for some people, but my updates are rely heavily on transactions. I can't have updates happening behind my back that are outside of transaction control. For this reason, I actually call CanceUpdates to clear the cache, even for successful updates. It's faster, and I don't get the retries. Plus, in my code I always to a requery after an update anyway. I think if I used CommitUpdates, I might not have to do a requery (I don't remember). > So if I make some changes, call ApplyUpdates(), then CommitUpdates(), > then makes some changes, repeat the ApplyUpdates() and > CommitUpdates(), *then* call the Database->Commit(), will the first > changes get commited to the database? I believe so. > Also, if I want to cancel the changes to just one TQuery resultset, do > I need to call TQuery::Cancel(), TQuery::CommitUpdates(), or both, or > something else? Cancel only makes sense when a dataset is in insert or edit mode. The cancel operation takes the dataset back to browse mode, and aborts changes to that one record. If this is what you want, use Cancel. If you want to completely wipe all pending changes to all records in a datatset, call CancelUpdates. CommitUpdates may actually do something you don't want. PS: CommitUpdates and CancelUpdates only make sense in datasets that use CachedUpdates. Cancel is a routine that you can always use. > In the help files, the example shows to ApplyUpdates(), then call the > database Commit(), then CommitUpdates(). Is that sequence actually > required? It's not the required sequence, but I think it is the sequence that makes the most sense. -- Harold Howe [TeamB] BCB tips and articles: http://www.bcbdev.com Custom software development: http://www.bcbdev.com/resume.htm
Technical Details
Message-ID:
<3b98e394$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<h2n65t43f0hk3svu8lp2v4j31nkk8bjjrs@4ax.com> <3A53B9CD.4D9FA179@freenet.co.uk> <mf395tcc6pjv22kom13vh70ms90ivnu7ti@4ax.com> <3A54A62B.28F98F65@freenet.co.uk> <e696ntomanipk4oi4surrjo1j81jsrkime@4ax.com> <3B73C59F.2A438336@temporaldoorway.com> <6p38nt4tc31scf3m8ufsl5pd0nuhv7lp2g@4ax.com> <3B7A5939.91D95B8B@temporaldoorway.com> <mmmhptoq8jrmtnlln3si9h9t2vmfsun22p@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,f125cee301e69e65 X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2001-09-07 08:16:38 PST From: "Harold Howe \(TeamB\)" <hhowe@bcbdev.com> Newsgroups: borland.public.cppbuilder.database.multi-tier References: <h2n65t43f0hk3svu8lp2v4j31nkk8bjjrs@4ax.com> <3A53B9CD.4D9FA179@freenet.co.uk> <mf395tcc6pjv22kom13vh70ms90ivnu7ti@4ax.com> <3A54A62B.28F98F65@freenet.co.uk> <e696ntomanipk4oi4surrjo1j81jsrkime@4ax.com> <3B73C59F.2A438336@temporaldoorway.com> <6p38nt4tc31scf3m8ufsl5pd0nuhv7lp2g@4ax.com> <3B7A5939.91D95B8B@temporaldoorway.com> <mmmhptoq8jrmtnlln3si9h9t2vmfsun22p@4ax.com> Subject: Re: Questions on ApplyUpdates, CommitUpdates Date: Fri, 7 Sep 2001 10:11:35 -0500 Lines: 54 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 12.152.193.134 Message-ID: <3b98e394$1_1@dnews> X-Trace: dnews 999875476 12.152.193.134 (7 Sep 2001 08:11:16 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!dnews