Hi all,

I hit a problem using SQLite 3.2.8 with perl 5.8.7 and DBD::SQLite 1.13, 
ubuntu 6.06.
Actually I don't know for sure that it's a sqlite problem and not caused by 
DBD::SQLite, but I also don't know how to find out...

Below is a small perl script that reproduces the problem on my box, I hope 
there's someone around here that can cope with it as I can't provide C 
code:-(

The script uses a sqlite3 database with the simple schema

CREATE TABLE table1 (text NOT NULL);

It tries to insert a NULL value into the text column, which of course results 
in an exception. The exception is caught and another NULL insert is issued. 
This time, the script segfaults.

Calling the script with valgrind, the second NULL insert doesn't cause a 
segfault, but an exception "library routine called out of sequence(21) at 
dbdimp.c line 376". The script continues and tries one more, this time valid, 
insert, but this one also fails with "...out of sequence..."

In my "real" application (based on gtk2-perl), it is possible that an invalid 
insert / update is being done more than once (that way I initially hit the 
problem). I can't always reproduce the segfault; more often I get an 
exception saying "not an error(21) at dbdimp.c line 376". 

Here is the code (it uses Class::DBI; the behaviour is identical when using 
DBIx::Class):
#----------------------
#!/usr/bin/perl
use warnings;
use strict;

package My::Schema;
use base 'Class::DBI';
My::Schema->connection('dbi:SQLite:test.db');

package My::Schema::Table1;
use base 'My::Schema';
My::Schema::Table1->table('table1');
My::Schema::Table1->columns(All => 'text');

package main;
foreach (1..2) {
    print "$_.try to insert NULL value:\n"; 
    eval {
        My::Schema::Table1->create({ text => undef });
    };
    if ($@) {
        chomp $@;
        print "OOOPS: Caught exception >$@<!\n";
    }
}
# Try valid insert -> also fails!
My::Schema::Table1->create({ text => 'foo' });
#----------------------

I'd be very happy if somebody could try to reproduce the behaviour I'm seeing 
and possibly help to find out what's going (or what I'm doing) wrong here. If 
it's of any help, I can provide the valgrind output or other information as 
required.

Thank you very much in advance!

Stephan

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to