RE: DATETIME type in mysql?

From: Lindsay Steele (lsteel..inet.net.au)
Date: Thu Oct 14 2004 - 16:53:24 EDT

  • Next message: Steve Steinitz: "Identifying changed fields"

    The DATETIME you are talking about in MySQL maps quite well to the Date
    in the modeller.

     A (DATE) java.util.date has both a time and a date - so it is well
    matched to the DATETIME.

     I also use the Date and Time fields seperately in MySQL .. And map both
    to a java.util.date then just extract the bit I need when nessasary.

    -----Original Message-----
    From: Twan Kogels [mailto:twa..wansoft.com]
    Sent: Friday, 15 October 2004 5:21 AM
    To: cayenne-use..bjectstyle.org
    Subject: 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 - 16:53:23 EDT