🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.databases
Article #94

HELP: Are Cached Updates Broken in Delphi 4?

#94
From: R. Annand
Date: Fri, 03 Jul 1998 00:00
53 lines
2823 bytes
On upgrading from Delphi 3 to Delphi 4, my cached updates no longer appear to 
work - the TQuery.UpdatesPending is True, but the calls to TQuery.ApplyUpdates 
and TQuery.CommitUpdates no longer have my OnUpdateRecord handler get called 
at *all*.  I've traced through and found that it sets up the callback in the 
BDE, seemingly without problem, but the BDE simply never calls the callback, 
and comes back as though everything was okay.

If you want to see if you can duplicate the problem, set up on a form a 
TDBGrid, a TQuery, a TUpdateSQL, a TDataSource, and a TButton.

In the TQuery, set CachedUpdates to True, RequestLive to True, the 
DatabaseName at one of your aliases, the SQL to something simple along the 
lines of "SELECT * FROM MYTABLE", set Active to True and set the UpdateObject 
to point to the TUpdateSQL control.

In the TDataSource, set the DataSet to the TQuery.

In the TUpdateSQL, double-click on it, and let it generate the SQL code.

In the TDBGrid, set the DataSource to the TDataSource on the form.

You should have the table appear by this point.
Now, make an OnClick handler for the TButton that says:

procedure TMyForm.Button1Click(Sender: TObject);
begin
  Query1.ApplyUpdates;
  Query1.CommitUpdates;
end;

Run the program, add a new line or two, and click the button.  Now, shut down 
the program and re-run it.

Are those new lines still there?  On my system, under Delphi 3, they are.  
Under a newly-installed Delphi 4, they are NOT.

Please let me know whether I am chasing after proverbial red herrings here.  
I've a suspicion it's the new BDE, but am unsure on how to proceed (is it my 
install?  Does this work on "clean systems", and it's just some layover files 
from the old BDE? Is the BDE forgetting to set some registry items, and is 
consequently calling old .DLLs?? *sigh*)

I've even tried setting the Query1.DataBase.TransIsolation := tiDirtyRead (for 
local databases) and done a Query1.DataBase.ApplyUpdates([Query1]) in the 
button's click handler (the help reads as though this is the way it "should be 
done"), but the outcome is exactly the same.

*smile* Please help, if you can.

*sigh*

  --=- Ritchie Annand
Technical Details
Message-ID: <O6Zm1.2736$606.13569413@news.rdc1.ab.wave.home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,adab8bd2629238bf,start
X-Google-Attributes: gidffff5,public
X-Google-Thread: ff75c,adab8bd2629238bf,start
X-Google-Attributes: gidff75c,public
From: annandr-at@-cadvision-dot.-com (R. Annand)
Subject: HELP: Are Cached Updates Broken in Delphi 4?
Date: 1998/07/03
Message-ID: <O6Zm1.2736$606.13569413@news.rdc1.ab.wave.home.com>
X-Deja-AN: 368301130
NNTP-Posting-Date: Thu, 02 Jul 1998 21:29:34 PDT
Organization: @Home Network Canada
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop