in reply to datetimestamp faster/golf/prettier

What database are you using that requires you to do such a ridiculous thing?? Surely there's a function that your database provides that will allow you to either cast a string to the appropriate structure and/or provide the timestamp yourself.

For example, MySQL will do timestamping for you with the TIMESTAMP column. You can create a trigger in Oracle that will populate the timestamping column at the right time. Other RDBMS's have similar features. The only one I can think of that might require this is SQLite, but you aren't required to put it in any format for SQLite (as it stores everything as strings, anyway).

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Replies are listed 'Best First'.
Re^2: datetimestamp faster/golf/prettier
by Jaap (Curate) on Jul 20, 2004 at 14:55 UTC
    I'm using MySQL and i use the column with the timestamp as a (shared) primary key. I tried to insert a NULL and it gave me a nice error.
      I have a few questions:
      • Which version of MySQL? The handling of TIMESTAMP changes in v4.1.0 and 4.1.2
      • What error are you seeing?
      • Can you show me the structure of the table and the code used to insert the value?

      ------
      We are the carpenters and bricklayers of the Information Age.

      Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

      I shouldn't have to say this, but any code, unless otherwise stated, is untested

        I'm very sorry. It is Class:DBI that gave me the error:
        Can't create Doc::Node object with null primary key columns () at ./db +itest.pl line 38