in reply to DBI mysql question

Ugh! Doesn't anyone else think thats icky? Why should a timestamp field update itself, without being told to?

If it wants updating, it should have to be created with something like:
logged TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP;

.. Thats DB2 syntax, anyway.. Especially if one can allow NULL values, kinda silly I think.. hohum

C.

Replies are listed 'Best First'.
Re: Re: DBI mysql question
by mpeppler (Vicar) on Mar 03, 2004 at 16:19 UTC
    At least here the TIMESTAMP is actually time-related. With Sybase and MS-SQL a "timestamp" column is just an 8 byte binary value that bears no relation to the time or date, and it does get updated every time you modify the table.

    It is actually quite useful when using optimistic locking - you fetch the value of the timestamp along with your other columns, let the user make edits, and then before committing the edits you verify that the timestamp value is unchanged, thus guaranteeing that no one else has modified the row while the user was making the changes.

    Michael