On Oct 10, 2005, at 7:35 AM, [EMAIL PROTECTED] wrote:

Sorry the precedent message was in french :-(

I encountered a weird error using DBD::SQLite.

This code works good :

use DBI;
$dbh= DBI->connect("dbi:SQLite:dbname=./backup.db")|| warn $!;
$dbh->{TraceLevel} = "3|SQL";
$req='delete from logs where date not in (select date from logs order
by date desc limit 50)';
$dbh->do($req);

but this code does not work with perl DBD::SQLite :

use DBI;
$dbh= DBI->connect("dbi:SQLite:dbname=./backup.db")|| warn $!;
$dbh->{TraceLevel} = "3|SQL";
$req='delete from logs where date not in (select date from logs order
by date desc limit (select nlpurge from settings))';
# of course nlpurge=50 in table settings
$dbh->do($req);

but the request works with sqlite3 interpreter as follows :

sqlite3 mydb.sqlite "delete from logs where date not in (select date
from logs order by date desc limit (select nlpurge from settings))"

Do you have any idea why this does not work ?


how about giving us the error as well. We have no way of determining what "this does not work" mean. One thought would have been to check if "SELECT nlpurge FROM settings" is returning a single value or not. However, you say the DELETE statement works fine directly in SQL. So, now it boils down to what error you are getting. Please report that.


--
Puneet Kishor

Reply via email to