Board index » delphi » CachedUpdates

CachedUpdates

I always get an EDatabaseError when I call the Query.ApplyUpdates
Method. If this method is within a transaction all changes are thrown.
Without transactions the changes
are saved although the Error occurs.

The error is that the table was read only. What is wrong here?

Thanks in advance.

Rene

 

Re:CachedUpdates


Quote
>I always get an EDatabaseError when I call the Query.ApplyUpdates
>Method. If this method is within a transaction all changes are thrown.
>Without transactions the changes
>are saved although the Error occurs.

I think you should call ApplyUpdates always within a transaction, otherwise
you will be defeating the cached-updates purpose.

This will be done automatically for you if you call
Database.ApplyUpdates( [dataset,...] ), instead of TBDEDataset.ApplyUpdates.

Quote
>The error is that the table was read only. What is wrong here?

When does this happen? With deletes, updates...? Are absolutely all the
modified records saved? Are you updating the same table, using an
UpdateObject, or perhaps you are using the OnUpdateRecord event?
Quote
>Thanks in advance.

>Rene

Re:CachedUpdates


Pedro Agull schrieb:

Quote
> I think you should call ApplyUpdates always within a transaction,
> otherwise
> you will be defeating the cached-updates purpose.

> This will be done automatically for you if you call
> Database.ApplyUpdates( [dataset,...] ), instead of
> TBDEDataset.ApplyUpdates.

That is right. But if I call ApplyUpdates within a transaction, the
update is cancelled as the error 'table is read only' occurs. If I call
it without a transaction, the changes are saved but the error still
occurs.

Quote

> When does this happen? With deletes, updates...? Are absolutely all
> the
> modified records saved? Are you updating the same table, using an
> UpdateObject, or perhaps you are using the OnUpdateRecord event?

It does always happen: Modify, Insert and Delete. I only tried a very
simple example that uses the following Query

SELECT * FROM TABLE WHERE ID = 1234

The UpdateSQL has the following statement in the i.e. ModifySQL

UPDATE TABLE SET FIELD1 = 'XXXXX', FIELD2 = 'YYYYY'
WHERE ID = 1234

The ApplyUpdates-Method is called when an OK-Button is clicked.

I tried this against Interbase 4.2 and Paradox 7 tables with the same
result.

Ren

Other Threads