Subject: | Can't load SQLite::VirtualTable extension via DBD::SQLite |
When I try to load the SQLite::VirtualTable extension module using "select
load_extension('perlvtab.so')", the next time I try to execute another query, the program exits
and I get the following error message:
Can't make DBI com handle for DBD::SQLite::st: unknown package.
Running the same commands under the sqlite3 shell does not have this problem.
I attached a test case that demonstrates the problem. I have only tried it with the
SQLite::VirtualTable extension module. I have tested it on ArchLinux 64-bit and Mac OS X 10.8
64-bit.
Subject: | test.pl |
#!/usr/bin/env perl
use DBI;
use File::Temp;
use Text::CSV;
use strict;
use warnings;
my $dbh = DBI->connect("dbi:SQLite::memory:", undef, undef, {
RaiseError=>1,
PrintError=>1,
});
# load the virtual table extension
$dbh->sqlite_enable_load_extension(1);
my $libname = shift || '/usr/local/lib/perlvtab.so';
my $sth;
$sth = $dbh->prepare('select load_extension('.$dbh->quote($libname).')');
$sth->execute;
my $sth2 = $dbh->prepare('create table t (c1 text);');
$sth2->execute;
ok(1);