in reply to to_days(now())

In the future it might help to post the code you are having trouble with. Also questions about SQLite might get better replies if posted to the SQLite mailing list. Anyway I get errors when I call NOW() or TO_DAYS().
$sql = "SELECT NOW()"; $sth = $dbh->prepare($sql) or die "Error:" . $dbh->errstr . "\n"; $sth->execute() or die "Error:" . $sth->errstr . "\n"; while(my $row = $sth->fetchrow_hashref) { print Dumper($row); }
produces:
Error:no such function: NOW(1) at dbdimp.c line 263

The docs for DBD::SQLite describe creating a NOW() function via:
$dbh->func( 'now', 0, sub { return time }, 'create_function' );

Replies are listed 'Best First'.
Re^2: to_days(now())
by Anonymous Monk on Jan 16, 2005 at 03:14 UTC
    $sql_stmt = qq~ delete from session where (((to_days(now()) * $day_minute) + (hour(now()) * $hour_ +minute) + minute(now())) - ((to_days(last_req) * $day_minute) + (hour(last_req) * $hour_m +inute) + minute(last_req))) > $session_limit~; $sth = $dbh->prepare($sql_stmt); $sth->execute() or &error("1SQL&Couldn't execute statement: $D +BI::errstr"); $sth->finish();
    I read from CPAN, but I am confuse how to implement it. Can some one show how to do that with my code.