in reply to Re: Testing and database date functions
in thread Testing and database date functions

No, sorry, the code is already written. I just want to test it now. What I am trying to do is to verify that the code will run the tests correctly for every day of a week. And I don't want to make any changes to production sql while doing that.

I was referring to a "generic" current_date() database function... kind of like pseudocode... The actual function's name could be sysdate(), now(), 'current date'... most of this stuff is database-specific as you rightly noticed.

  • Comment on Re^2: Testing and database date functions

Replies are listed 'Best First'.
Re^3: Testing and database date functions
by hmerrill (Friar) on Dec 10, 2004 at 13:06 UTC
    Ok then. I don't know of an existing module that does that, so I'm guessing you'll have to roll your own. Shouldn't be that tough - you can use the database handle function get_info. Here are the get_info numbers that can be used as parameters:
    Type Name Example A Example B ---- -------------------------- ------------ ---------------- 17 SQL_DBMS_NAME 'ACCESS' 'Oracle' 18 SQL_DBMS_VER '03.50.0000' '08.01.0721 ...' 29 SQL_IDENTIFIER_QUOTE_CHAR '`' '"' 41 SQL_CATALOG_NAME_SEPARATOR '.' '@' 114 SQL_CATALOG_LOCATION 1 2
    so you could use
    my $dbms_name = $dbh->get_info(17);
    your new function could take in the $dbh handle, and call get_info(17) to get the dbms name, and once you know the name, you can construct the database specific SQL that will get you the day of the week for that database.

    HTH.