diff --git a/Changes b/Changes index 9fe0f53..5a0db02 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,26 @@ Revision history for Perl extension DBD-SQLite. 1.19_07 not released yet - - re-enable and fix t/70schemachange.t, as per RT #43448 (CORION) - - added a canary test to probe for RT #36863 (segfault on OSX 10.5.2) + - Starting to work the RT queue now the basics are settled. + - Re-enable and fix t/70schemachange.t, as per RT #43448 (CORION) + - Added a canary test to probe for RT #36863 (segfault on OSX 10.5.2) (CORION) + - Added resources links to META.yml (ADAMK) + - Resolved #30502: t\70schemachange.t fails on Windows (ADAMK) + - Resolved #30167: Specify configuration depenencies with "configure_requires" (ADAMK) + - Resolved #17623: make test fails when DBI_DSN is not DBD::SQLite (ADAMK) + - Resolved #13631: wish: column_info support() (CORION) + - Resolved #39938: Read-access to development repository (ADAMK) + - Resolved #18617: Build error under win32 (ADAMK) + - Resolved #35838: support for DBI::column_info call (CORION) + - Resolved #29497: POD content bug (ADAMK) + - Resolved #29520: 1.14 fails in test 6 (ADAMK) + - Resolved #44647: Makefile.PL syntax error (ADAMK) + - Resolved #29519: t/70schemachange.t failure (ADAMK) + - Resolved #20286: DBD::SQLite leaks file descriptors (ADAMK) + - Resolved #21406: DBD-SQLite 1.13 broke Class-DBI (ADAMK) + - Resolved #4591: Test suite (t/t50*.t) is order dependent / bug in t/lib.pl? (ADAMK) + - Resolved #36467: Name "DBD::SQLite::sqlite_version" used only once (ADAMK) + - Resolved #7753: DBD::SQLite error shouldn't include extraneous info (ADAMK) 1.19_06 Sat 4 Apr 2009 - Fixed a segv with an error function under x86 linux diff --git a/Makefile.PL b/Makefile.PL index 49fec97..a954404 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -203,6 +203,9 @@ WriteMakefile( OPTIONAL( '6.31', LICENSE => 'perl', ), + OPTIONAL( '6.11', + AUTHOR => 'Adam Kennedy ', # Maintainer + ), OPTIONAL( '6.46', META_MERGE => { configure_requires => { @@ -210,6 +213,11 @@ WriteMakefile( 'File::Spec' => (WINLIKE ? '3.27' : '0.82'), 'DBI' => '1.21', }, + resources => { + license => 'http://dev.perl.org/licenses/', + bugtracker => 'http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBD-SQLite', + repository => 'http://svn.ali.as/cpan/trunk/DBD-SQLite', + }, }, ), OBJECT => ( $force_local ? '$(O_FILES)' : 'SQLite.o dbdimp.o' ), diff --git a/dbdimp.c b/dbdimp.c index 96afa13..a5d5abc 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -40,9 +40,10 @@ _sqlite_error(char *file, int line, SV *h, imp_xxh_t *imp_xxh, int rc, char *wha SV *errstr = DBIc_ERRSTR(imp_xxh); sv_setiv(DBIc_ERR(imp_xxh), (IV)rc); sv_setpv(errstr, what); - sv_catpvf(errstr, "(%d) at %s line %d", rc, file, line); + /* #7753: DBD::SQLite error shouldn't include extraneous info */ + /* sv_catpvf(errstr, "(%d) at %s line %d", rc, file, line); */ - if (DBIS->debug >= 3) { + if ( DBIS->debug >= 3 ) { PerlIO_printf(DBILOGFP, "sqlite error %d recorded: %s at %s line %d\n", rc, what, file, line); } diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm index e389599..d0ee899 100644 --- a/lib/DBD/SQLite.pm +++ b/lib/DBD/SQLite.pm @@ -601,7 +601,7 @@ rather than the size of the blob in bytes. In order to store natively as a BLOB use the following code: use DBI qw(:sql_types); - my $dbh = DBI->connect("dbi:sqlite:/path/to/db","",""); + my $dbh = DBI->connect("dbi:SQLite:dbfile","",""); my $blob = `cat foo.jpg`; my $sth = $dbh->prepare("INSERT INTO mytable VALUES (1, ?)"); diff --git a/t/07_error.t b/t/07_error.t index 8ff1b87..45a59f7 100644 --- a/t/07_error.t +++ b/t/07_error.t @@ -6,14 +6,16 @@ BEGIN { $^W = 1; } -use Test::More tests => 3; +use Test::More tests => 7; use t::lib::Test; my $dbh = connect_ok( RaiseError => 1, PrintError => 0 ); eval { $dbh->do('ssdfsdf sdf sd sdfsdfdsf sdfsdf'); }; -ok($@); +ok($@, 'Statement 1 generated an error'); +is( $DBI::err, 1, '$DBI::err ok' ); +is( $DBI::errstr, 'near "ssdfsdf": syntax error', '$DBI::errstr ok' ); $dbh->do('create table testerror (a, b)'); $dbh->do('insert into testerror values (1, 2)'); @@ -23,4 +25,6 @@ $dbh->do('create unique index testerror_idx on testerror (a)'); eval { $dbh->do('insert into testerror values (1, 5)'); }; -ok($@); +ok($@, 'Statement 2 generated an error'); +is( $DBI::err, 19, '$DBI::err ok' ); +is( $DBI::errstr, 'column a is not unique', '$DBI::errstr ok' ); diff --git a/t/28_schemachange.t b/t/28_schemachange.t index d599635..306a109 100644 --- a/t/28_schemachange.t +++ b/t/28_schemachange.t @@ -60,15 +60,15 @@ while (Testing()) { or DbiError($dbh->err, $dbh->errstr); my $pid; - if (!defined($pid = fork())) { + if ( not defined($pid = fork()) ) { die("fork: $!"); - } elsif ($pid == 0) { + } elsif ( $pid == 0 ) { # Child: drop the second table - if ($^O =~ /win32/i) { + if ( $^O =~ /win32/i ) { # sqlite prohibits thread sharing parent connection $dbh = DBI->connect("DBI:SQLite:dbname=foo", '', ''); } - if (!$state) { + if ( not $state ) { $dbh->do("DROP TABLE $table2") or DbiError($dbh->err, $dbh->errstr); $dbh->disconnect() @@ -80,7 +80,7 @@ while (Testing()) { # Parent: wait for the child to finish, then attempt to use the database Test(waitpid($pid, 0) != -1) or print("waitpid: $!\n"); - if ($^O =~ /win32/i) { + if ( $^O =~ /win32/i ) { # schema changed, need to reconnect $dbh = DBI->connect("DBI:SQLite:dbname=foo", '', ''); } diff --git a/t/rt_21406_auto_finish.t b/t/rt_21406_auto_finish.t new file mode 100644 index 0000000..c616925 --- /dev/null +++ b/t/rt_21406_auto_finish.t @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More; +use t::lib::Test; +BEGIN { + if ( $DBI::VERSION >= 1.40 ) { + plan( tests => 10 ); + } else { + plan( skip_all => 'DBI 1.40+ only' ); + } +} + +my $dbh = connect_ok( RaiseError => 1 ); +$dbh->do("CREATE TABLE f (f1, f2, f3)"); +$dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 1); +$dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 2); +$dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 3); +$dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 4); +$dbh->do("INSERT INTO f VALUES (?, ?, ?)", {}, 'foo', 'bar', 5); + +SCOPE: { + my $sth1 = $dbh->prepare_cached('SELECT * FROM f ORDER BY f3', {}); + isa_ok( $sth1, 'DBI::st' ); + ok( $sth1->execute, '->execute ok' ); + is_deeply( $sth1->fetchrow_arrayref, [ 'foo', 'bar', 1 ], 'Row 1 ok' ); + is_deeply( $sth1->fetchrow_arrayref, [ 'foo', 'bar', 2 ], 'Row 2 ok' ); + my $sth2 = $dbh->prepare_cached('SELECT * FROM f ORDER BY f3', {}, 3); + isa_ok( $sth2, 'DBI::st' ); + ok( $sth2->execute, '->execute ok' ); + is_deeply( $sth2->fetchrow_arrayref, [ 'foo', 'bar', 1 ], 'Row 1 ok' ); + is_deeply( $sth2->fetchrow_arrayref, [ 'foo', 'bar', 2 ], 'Row 2 ok' ); + ok( $sth2->finish, '->finish ok' ); +} + +$dbh->disconnect;