Re: Deleting a record



If I wait a while and then read the table, the deleted record is gone
and everthing is OK. But I do not want to wait to read the table.

Is there a way to refresh the Access table using a query?


We did originally have problems with two co-operating processes where
although ProcessA had written a set of rows (in a transaction), ProcessB
couldn't see any of them (?or only some of them?) until some short time
later.

My code now contains two bodges which between them seem to have fixed this
problem...

1)
private
fJetEngine : OleVariant ;


procedure Synchronise_MsAccess ;
begin
// First time through we need to create the OLE object
if VarIsEmpty ( fJetEngine ) then begin
fJetEngine := CreateOleObject ( 'JRO.JetEngine' ) ;
end ;

// "Ensure that my read cache is consistent with the database on
disk" ***
fJetEngine.RefreshCache ( fSasAdoConnection.Internal_ConnectionObject
) ;

end ; // Synchronise_MsAccess


*** Note the wording on that comment! - There does not (did not?) appear
to be any way to force the updates to be immediately flushed TO disk,
rather this "RefreshCache" forces subsequent accesses to actually read
FROM the disk tables


2) Although while looking through Google Groups to see /why/ I had this
next line of code in my app, I found the following note...

There is at least one method of forcing Jet to immediately flush all
updates
to disk in ADO. This method involves use of a transaction and a property
exposed by the Microsoft Jet OLE DB provider called "JET OLEDB:Transaction
Commit Mode". With this property set to 1 (default is 0), any changes
made within a transaction are
flushed to disk when the transaction is committed. For example:

'open a connection
cn.Open
cn.Properties("Jet OLEDB:Transaction Commit Mode") = 1
'open your recordset
cn.BeginTrans
'do some work
rs.Update
cn.CommitTrans ' updates flushed to disk on commit

When this connection is closed and reopened, the "Jet OLEDB:Transaction
Commit Mode" property is reset to its default value of 0.


In Delphi-ADO-speak, this can be effected by...

(AdoConnection.ConnectionObject as _Connection).Properties.Item ['Jet
OLEDB:Transaction Commit Mode'].Value := 1

- and I think this only needs to be called once after the connection is
opened (not once per transaction)


While BOTH bodges seem to be /sufficient/ to allow my processes to
co-operate, I haven't done any testing to see if both are actually
/necessary/

HTH

You can also modify the "Page timeout" property.

The default is 5000
adoconnection1.properties.Item['Jet OLEDB:Page Timeout'].Value:=500;

--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.



Relevant Pages

  • Re: Deleting a record
    ... We did originally have problems with two co-operating processes where although ProcessA had written a set of rows (in a transaction), ProcessB couldn't see any of them until some short time later. ... to be any way to force the updates to be immediately flushed TO disk, rather this "RefreshCache" forces subsequent accesses to actually read FROM the disk tables ... There is at least one method of forcing Jet to immediately flush all updates ...
    (borland.public.delphi.database.ado)
  • Re: [GIT PULL] Ext3 latency fixes
    ... which unplugged the write queue after every page write. ... In guarded mode the on disk i_size is not updated until after the data ... The end_io handler puts the buffer onto the per-sb list of guarded ... One big gotcha is that we starting a transaction while a page is ...
    (Linux-Kernel)
  • Re: implementing a database log
    ... required for roll back of an uncommitted transaction during recovery. ... dirty pages to disk in the background. ...
    (comp.databases.theory)
  • Re: implementing a database log
    ... required for roll back of an uncommitted transaction during recovery. ... dirty pages to disk in the background. ...
    (comp.databases.theory)
  • Re: Do Transactions guard against corruption?
    ... into one, that is called replication. ... But Jet replication does not use ... In replication or a multi-user database? ... they are not locked out as soon as the transaction also append ...
    (microsoft.public.access.modulesdaovba)