TZUpdateSQL and other questions

Forum related to version 6.1.5 of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
chuckie
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 22.11.2005, 16:49

TZUpdateSQL and other questions

Post by chuckie »

hi everybody,
I'm compiling a program with Delphi 7 + MySQL and ZeosLib 6.1.5.


I have a Table (users_t) with a field called 'lastupdt', TIMESTAMP kind.
Well,first question:
Why, with a ZTUsers.Append and then ZTUsers.Post, doesn't the 'lastupdt' field update itself automaticly, as well as I expect ?

second question:
Please let me know how do you use ZUpdateSQL .
Where is, in its properties, DBConnection? Where is Active=true/false?

Thank you for your kind attention
regards from ITALY
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post by pol »

Hi!

From the MySQL Manual:
Automatic updating of the first TIMESTAMP column occurs under any of the following conditions:

* The column is not specified explicitly in an INSERT or LOAD DATA INFILE statement.
* The column is not specified explicitly in an UPDATE statement and some other column changes value. (Note that an UPDATE that sets a column to the value it already has will not cause the TIMESTAMP column to be updated, because if you set a column to its current value, MySQL ignores the update for efficiency.)
* You explicitly set the TIMESTAMP column to NULL.
So you might try to set your TField lastupdt.value to NULL before you post. That should work.

You only need a ZUpdateSQL if you want to do something special, update several tables etc. Normally the Zeos-generated update code is sufficient. If you need a ZUpdateSQL, you put its name in the UpdateObject property (combobox, it will show a ZUpdateSQL on the form) of a ZQuery or ZTable.

HTH
Rüdiger
Post Reply