DATETIME type in mysql?

From: Twan Kogels (twa..wansoft.com)
Date: Thu Oct 14 2004 - 15:21:17 EDT

  • Next message: Mike Kienenberger: "Re: DATETIME type in mysql?"

    Hello all,

    I've testing my webapplication and found a problem when using TIMESTAMP
    with mysql.

    In mysql the TIMESTAMP type does not act like a normal TIMESTAMP. I'll quote:
    ============
    The TIMESTAMP column type provides a type that you can use to automatically
    mark INSERT or UPDATE operations with the current date and time. If you
    have multiple TIMESTAMP columns in a table, only the first one is updated
    automatically.
    ============
    <http://dev.mysql.com/doc/mysql/en/TIMESTAMP_pre-4.1.html>

    This means when you don't specify a value for TIMESTAMP mysql just
    overwrites the current value with a new time value. That's kind of stupid.

    Mysql also has a DATETIME type, that's used for date+time values, for
    example "10-10-2004 10:29". I've looked into the Modeler but could not find
    the DATETIME type for a DBentity. I've found DATE (only used for dates
    "10-10-2004") and TIME (only used for time "10:29").

    If you want to use date and time then the only choice seems to TIMESTAMP,
    but that type has very strange non standard effects in mysql.

    In mysql 4.1 you can turn off the strange effects of TIMESTAMP, but 4.1
    version is still only for development.

    In my situation i've got 2 TIMESTAMP columns, one is always filled, but one
    can be NULL (or empty). But in mysql a TIMESTAMP can't be NULL/empty. When
    i specify NULL mysql's non standard function get activated which inserts
    the current time in my NULL column.

    Does cayenne supports DATETIME type of mysql or is there any other way
    around the TIMESTAMP problem?

    Cheers,
    Twan (thinking about throwing mysql away)



    This archive was generated by hypermail 2.0.0 : Thu Oct 14 2004 - 15:19:16 EDT