Board index » delphi » CachedUpdates

CachedUpdates

Hi,

I want to make sure I can do what I think I can do with TUpdateSQL.
Is it possible to add inserts/updates/deletes for many records in one
TUpdateSQL?  For example, if I am inserting 100 records, do I have to
call ApplyUpdates after each record, or can I store all 100, then call
update?  If it is possible to add them all then call ApplyUpdates, do
I just do
UpdateSQL1.InsertQuery.Add('Insert into ....);
for as many records that I want to insert?

What if I want to update two things on the same record.  First I
insert the record, then I set a whole bunch of fields to NULL in an
update statement.  Can I do that with a TUpdateSQL?  If so, how does
the component know to insert first, then update?

Thanks in advance,
Elizabeth MacKay

 

Re:CachedUpdates


Maybe this will shed some light:

On 3 Apr 2003 07:54:52 -0800, EMac...@northropgrumman.com (Elizabeth

Quote
MacKay) wrote:
>Hi,

>I want to make sure I can do what I think I can do with TUpdateSQL.
>Is it possible to add inserts/updates/deletes for many records in one
>TUpdateSQL?

Yes, the TUpdatesql will operate on all records in the cache. Maybe
not the answer to your question, tho
Quote
>  For example, if I am inserting 100 records, do I have to
>call ApplyUpdates after each record, or can I store all 100, then call
>update?  If it is possible to add them all then call ApplyUpdates, do
>I just do
>UpdateSQL1.InsertQuery.Add('Insert into ....);
>for as many records that I want to insert?

Not if the added records are already added to the cached dataset.
Quote

>What if I want to update two things on the same record.  First I
>insert the record, then I set a whole bunch of fields to NULL in an
>update statement.  Can I do that with a TUpdateSQL?  If so, how does
>the component know to insert first, then update?

I think that you are doing something that the updatesql object was not
designed to do, which is to allow updates to readonly datasets. For
example, using the BDE, a dataset from a JOIN can't be a live dataset,
so it can't be modified then applied and comitted. The TUpdateSQL
helps you keep track of the before and after values, and which fields
belong to the table you are updating.

For your problem, it might be easier to just run a series of queries
to do the several operations you need.

HTH,
Dan

Quote
>Thanks in advance,
>Elizabeth MacKay

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com
[SPAM block: my e-mail address is DanB at CMDCsystems.com]

Other Threads