Erreur avec DBD::SQLite

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Erreur avec DBD::SQLite

cscetbon
Salut,

Je rencontre une erreur bizarre avec le module DBD::SQLite.

Le code suivant passe correctement :

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);

Mais celui-ci bloque le script :

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))';
# bien s?r nlpurge=50 dans la table settings
$dbh->do($req);

Par contre la requ?te passe correctement avec l'interpr?teur :

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

Quelqu'un aurait il une id?e ?

PS: j'utilise la version 1.09 du module DBD::Sqlite

Merci d'avance.

Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

cscetbon
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 ?


I use version 1.09

Thanks

Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

Puneet Kishor

On Oct 10, 2005, at 7:35 AM, [hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

cscetbon


Puneet Kishor wrote:

>
> On Oct 10, 2005, at 7:35 AM, [hidden email] 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.

No error code is returned cause the script is blocked by the instruction
$dbh->do($req);

>
>
> --
> Puneet Kishor
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

Puneet Kishor

On Oct 10, 2005, at 8:03 AM, Cyril Scetbon wrote:

>
>
> Puneet Kishor wrote:
>
>>
>> On Oct 10, 2005, at 7:35 AM, [hidden email] 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.
>
>
> No error code is returned cause the script is blocked by the
> instruction $dbh->do($req);

perl -d "yourscript"

--
Puneet Kishor

Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

Scott Leighton
In reply to this post by cscetbon
On Monday 10 October 2005 6:03 am, Cyril Scetbon wrote:
>
> No error code is returned cause the script is blocked by the instruction
> $dbh->do($req);
>

   Change that line to

   $dbh->do($req) or die $dbh->errstr;

   to get an error displayed.

   Scott

--
POPFile, the OpenSource EMail Classifier http://popfile.sourceforge.net/
Linux 2.6.11.4-21.9-default x86_64
SuSE Linux 9.3 (x86-64)
Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

cscetbon


Scott Leighton wrote:

>On Monday 10 October 2005 6:03 am, Cyril Scetbon wrote:
>  
>
>>No error code is returned cause the script is blocked by the instruction
>>$dbh->do($req);
>>
>>    
>>
>
>   Change that line to
>
>   $dbh->do($req) or die $dbh->errstr;
>
>   to get an error displayed.
>
>   Scott
>  
>
I used it but no error is printed. What is weird is that it works on
Linux with the same version of DBD but not on windows. Moreover windows
is swapping.

I noticed another error. When I try
sqlite3 backup.db "select * from logs where date not in (select date
from logs order by date desc limit (select nlpurge from settings))"
I get Segmentation fault
Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

Scott Leighton
On Monday 10 October 2005 2:32 pm, Cyril Scetbon wrote:

> Scott Leighton wrote:
> >On Monday 10 October 2005 6:03 am, Cyril Scetbon wrote:
> >>No error code is returned cause the script is blocked by the instruction
> >>$dbh->do($req);
> >
> >   Change that line to
> >
> >   $dbh->do($req) or die $dbh->errstr;
> >
> >   to get an error displayed.
> >
> >   Scott
>
> I used it but no error is printed. What is weird is that it works on
> Linux with the same version of DBD but not on windows. Moreover windows
> is swapping.
>
> I noticed another error. When I try
> sqlite3 backup.db "select * from logs where date not in (select date
> from logs order by date desc limit (select nlpurge from settings))"
> I get Segmentation fault


    Try checking the windows database for corruption.

   Scott


--
POPFile, the OpenSource EMail Classifier http://popfile.sourceforge.net/
Linux 2.6.11.4-21.9-default x86_64
SuSE Linux 9.3 (x86-64)
Reply | Threaded
Open this post in threaded view
|

Re: Erreur avec DBD::SQLite

cscetbon
it seems there are not errors cause I can dump it, use it without
warning.  Maybe a select request in the limit clause is not supported ?

Scott Leighton wrote:

>On Monday 10 October 2005 2:32 pm, Cyril Scetbon wrote:
>  
>
>>Scott Leighton wrote:
>>    
>>
>>>On Monday 10 October 2005 6:03 am, Cyril Scetbon wrote:
>>>      
>>>
>>>>No error code is returned cause the script is blocked by the instruction
>>>>$dbh->do($req);
>>>>        
>>>>
>>>  Change that line to
>>>
>>>  $dbh->do($req) or die $dbh->errstr;
>>>
>>>  to get an error displayed.
>>>
>>>  Scott
>>>      
>>>
>>I used it but no error is printed. What is weird is that it works on
>>Linux with the same version of DBD but not on windows. Moreover windows
>>is swapping.
>>
>>I noticed another error. When I try
>>sqlite3 backup.db "select * from logs where date not in (select date
>>from logs order by date desc limit (select nlpurge from settings))"
>>I get Segmentation fault
>>    
>>
>
>
>    Try checking the windows database for corruption.
>
>   Scott
>
>
>  
>