OnUpdateRecord ?

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
pjonard
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 09.08.2008, 17:55

OnUpdateRecord ?

Post by pjonard »

slt, tout nouveau, j'ai découvert avec joie ZeosLib (j'avais la version 6.62) que j'utilise pour une application Firebird Embedded sous Delphi 2007 Win32

Via un TZTable j'ai un evenement OnUpdateRecord que je voudrais utiliser pour enregistrer dans un fichier log les modifications ou ajout dans l'objectif de faire par la suite une possible synchronisation de données et également un backup vers un site.

L'évenement ne se déclenche pas ? J'ai fait une recherche et un postit indique qu'il faut peut être le rajouter ^^ pourriez vous m'indiquer la démarche à suivre ? merci d'avance de votre collaboration
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

pjonard,

Veuillez essayer d'utiliser l'anglais dans le forum. La plupart des utilisateurs ici parlent ni comprennent la langue de Molière. En ce qui concerne moi, je le comprend assez bien, mais écrire c'est pas mon dada. Donc... on continue en anglais.

Are you using the 6.6.3 version now?
I just checked the code. Seems like the TZTable.OnUpdateRecord event code isn't called, indeed.
So, it's quite a useless property to set now. I propose you file a bug report on http://zeosbugs.firmos.at/ If you know how to fix the issue you can also attach the patch.

Some side remarks
- If you want to make a log file you could eventually try to use the TZSqlMonitor component. It logs all actions sent to the database. (Including updates/inserts)
- For a backup : don't rely on logs. If they are not complete (eg. because of a coding error from your side) your lost. I suggest a simple file copy after closing the database file. Or, if Firebird supports it, a database export using a firebird command
- In case you're not using Providers and ClientDatasets you could also use a TZUpdateSql component linked to you table and use it to execute 2 sql statements for every update.

Mark
Last edited by mdaems on 10.08.2008, 08:00, edited 1 time in total.
Image
pjonard
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 09.08.2008, 17:55

Post by pjonard »

sorry to write in french ^^

i'm using the new release of ZeosLib 6.6.3 .
I'm trying to implemente the event OnUpdateRecord but i'm not sure to put this on the right place.
I'm trying to use the TSqlMonitor but when i'm read Statement i haven't the new value only '?' like UPDATE FICHE SET fiche_Horodate=? WHERE fiche_id=? AND fiche_poste=?
I'm try to contruct the statement on the event AfterPost but Fields.NewValue and Fields.OldValue are identical !

I go to see your link Mantis

i'm reading your post (05.02.2008, 15:43) but i don't understand all ^^
My first impression is that these handles should be passed to the CachedResultset object that's behind the Dataset Object.
There it could be handled by the TZAbstractCachedResultSet.PostRowUpdates procedure.
Eventually you could put the handling of these events in the ZGenericCachedResolver but in that case it should also be added to the TZUpdateSQL program.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Thanks for making the bug report. This way we keep aware this is still an open issue.

Concerning the quote : I wanted to explain where the call to the event code should be included. The code posting the updates is in TZAbstractCachedResultSet.PostRowUpdates. So when creating the TZAbstractCachedResultSet object the pointer to the OnUpdateRecord eventcode should be passed. And when the PostRowUpdates call is executing and the procedure pointer is not nil it should be called.
The story about the ZGenericCachedResolver : This object is used by the TZAbstractCachedResultSet.PostRowUpdates method to execute the effective updates. Maybe here we would have more details information on the effectively used statements, but this would also involve changes to the TZUpdateSQL component.

So if you want to dive into the code: have fun. It will require some study, but the more people do that, the more good patches and help we can get.

Mark
Image
Post Reply