Subject: | DBD::SQLite does not implement $sth->{NULLABLE} |
It seems that DBD::SQLite flat out does not implement the NULLABLE $sth
attribute as described in DBI.pm. Attached is a failing test patch for
t/60metadata.t
Subject: | nullable_fail.diff |
diff -ru DBD-SQLite-1.14/t/60metadata.t DBD-SQLite-1.14patched/t/60metadata.t
--- DBD-SQLite-1.14/t/60metadata.t 2007-08-23 02:01:06.000000000 +0200
+++ DBD-SQLite-1.14patched/t/60metadata.t 2008-11-01 16:05:57.806987272 +0100
@@ -1,6 +1,7 @@
use Test;
-BEGIN { plan tests => 27 }
+BEGIN { plan tests => 33 }
use DBI;
+use Data::Dumper;
my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", { });
ok($dbh);
$dbh->{PrintError} = 0;
@@ -50,3 +51,23 @@
ok $dbh->do("create table meta5 ( f1 integer PRIMARY KEY )");
@pk = $dbh->primary_key(undef, undef, 'meta5');
ok($pk[0] eq 'f1');
+
+ok $dbh->do("create table meta6 (id INTEGER PRIMARY KEY NOT NULL, col1 varchar(2) NOT NULL, col2 varchar(2), col3 char(2) NOT NULL)" );
+my $sth = $dbh->prepare ('select * from meta6');
+ok $sth->execute;
+
+my $expected = {
+ NUM_OF_FIELDS => 4,
+ NAME_lc => [qw/id col1 col2 col3/],
+ TYPE => [qw/INTEGER varchar(2) varchar(2) char(2)/],
+ NULLABLE => [qw/0 0 1 0/],
+};
+
+for my $m (keys %$expected) {
+ local $Data::Dumper::Sortkeys = 1;
+ print "# Comparing $m\n";
+ my $got = Dumper ($sth->{$m});
+ my $exp = Dumper ($expected->{$m});
+ ok ($got eq $exp);
+ #or print "Got:\n$got\n Expected:\n$exp";
+}