Author: turnstep
Date: Sat Feb 16 19:29:13 2008
New Revision: 10754
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/META.yml
DBD-Pg/trunk/Makefile.PL
DBD-Pg/trunk/Pg.pm
DBD-Pg/trunk/README
DBD-Pg/trunk/t/02attribs.t
DBD-Pg/trunk/t/03dbmethod.t
Log:
Bump required DBI version to 1.52 to support thread work and fix memory leaks.
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Sat Feb 16 19:29:13 2008
@@ -4,6 +4,7 @@
- Use version.pm [CPAN bug #33206] [GSM]
- Add PERL_NO_GET_CONTEXT #define to improve performance on threaded
Perls
+ - Raise the minimum DBI version to 1.52.
- Remove '//' style comments to make strict ANSI compilers happy.
(Trevor Inman) [CPAN bug #33089]
- Force client encoding of UTF8 for some tests.
Modified: DBD-Pg/trunk/META.yml
==============================================================================
--- DBD-Pg/trunk/META.yml (original)
+++ DBD-Pg/trunk/META.yml Sat Feb 16 19:29:13 2008
@@ -10,17 +10,17 @@
dynamic_config : 1
requires:
- DBI : 1.45
+ DBI : 1.52
recommends:
Test::YAML::Meta : 0.03
Test::Pod : 0.95
build_requires:
- DBI : 1.45
+ DBI : 1.52
Test::Harness : 2.03
Test::Simple : 0.47
Module::Signature : 0.50
configure_requires:
- DBI : 1.45
+ DBI : 1.52
provides:
DBD::Pg:
Modified: DBD-Pg/trunk/Makefile.PL
==============================================================================
--- DBD-Pg/trunk/Makefile.PL (original)
+++ DBD-Pg/trunk/Makefile.PL Sat Feb 16 19:29:13 2008
@@ -140,7 +140,7 @@
ABSTRACT => 'PostgreSQL database driver for the DBI module',
PREREQ_PM => {
'ExtUtils::MakeMaker' => '6.11',
- 'DBI' => '1.45',
+ 'DBI' => '1.52',
'Test::Simple' => '0.61',
'Test::Harness' => '2.03',
},
Modified: DBD-Pg/trunk/Pg.pm
==============================================================================
--- DBD-Pg/trunk/Pg.pm (original)
+++ DBD-Pg/trunk/Pg.pm Sat Feb 16 19:29:13 2008
@@ -68,7 +68,7 @@
Exporter::export_ok_tags('pg_types', 'async');
@EXPORT = qw($DBDPG_DEFAULT PG_ASYNC PG_OLDQUERY_CANCEL
PG_OLDQUERY_WAIT PG_BYTEA);
- require_version DBI 1.45;
+ require_version DBI 1.52;
bootstrap DBD::Pg $VERSION;
Modified: DBD-Pg/trunk/README
==============================================================================
--- DBD-Pg/trunk/README (original)
+++ DBD-Pg/trunk/README Sat Feb 16 19:29:13 2008
@@ -66,7 +66,7 @@
-------------
build, test, and install Perl 5 (at least 5.6.1)
- build, test, and install the DBI module (at least 1.45)
+ build, test, and install the DBI module (at least 1.52)
build, test, and install PostgreSQL (at least 7.4)
build, test, and install Test::Simple (at least 0.47)
Modified: DBD-Pg/trunk/t/02attribs.t
==============================================================================
--- DBD-Pg/trunk/t/02attribs.t (original)
+++ DBD-Pg/trunk/t/02attribs.t Sat Feb 16 19:29:13 2008
@@ -461,22 +461,17 @@
# Test of the statement handle attribute "ParamTypes"
#
-SKIP: {
- skip 'DBI must be at least version 1.49 to test the DB handle attribute
"ParamTypes"', 2
- if $DBI::VERSION < 1.49;
-
- $sth = $dbh->prepare('SELECT id FROM dbd_pg_test WHERE id=? AND val=?
AND lii=?');
- $sth->bind_param(1, 1, SQL_INTEGER);
- $sth->bind_param(2, 'TMW', SQL_VARCHAR);
- $attrib = $sth->{ParamTypes};
- $expected = {1 => 'int4', 2 => 'varchar', 3 => undef};
- is_deeply( $attrib, $expected, q{Statement handle attribute
"ParamTypes" works before execute});
- $sth->bind_param(3, 3, {pg_type => PG_INT4});
- $sth->execute();
- $attrib = $sth->{ParamTypes};
- $expected->{3} = 'int4';
- is_deeply( $attrib, $expected, q{Statement handle attribute
"ParamTypes" works after execute});
-}
+$sth = $dbh->prepare('SELECT id FROM dbd_pg_test WHERE id=? AND val=? AND
lii=?');
+$sth->bind_param(1, 1, SQL_INTEGER);
+$sth->bind_param(2, 'TMW', SQL_VARCHAR);
+$attrib = $sth->{ParamTypes};
+$expected = {1 => 'int4', 2 => 'varchar', 3 => undef};
+is_deeply( $attrib, $expected, q{Statement handle attribute "ParamTypes" works
before execute});
+$sth->bind_param(3, 3, {pg_type => PG_INT4});
+$sth->execute();
+$attrib = $sth->{ParamTypes};
+$expected->{3} = 'int4';
+is_deeply( $attrib, $expected, q{Statement handle attribute "ParamTypes" works
after execute});
#
# Test of the statement handle attribute "RowsInCache"
Modified: DBD-Pg/trunk/t/03dbmethod.t
==============================================================================
--- DBD-Pg/trunk/t/03dbmethod.t (original)
+++ DBD-Pg/trunk/t/03dbmethod.t Sat Feb 16 19:29:13 2008
@@ -532,40 +532,35 @@
# Test of the "statistics_info" database handle method
#
-SKIP: {
-
- $DBI::VERSION >= 1.52
- or skip 'DBI must be at least version 1.52 to test the database
handle method "statistics_info"', 10;
+$dbh->{private_dbdpg}{version} >= 80000
+ or skip 'Server must be version 8.0 or higher to test database handle
method "statistics_info"', 10;
- $dbh->{private_dbdpg}{version} >= 80000
- or skip 'Server must be version 8.0 or higher to test database
handle method "statistics_info"', 10;
+$sth = $dbh->statistics_info(undef,undef,undef,undef,undef);
+is ($sth, undef, 'DB handle method "statistics_info" returns undef: no table');
- $sth = $dbh->statistics_info(undef,undef,undef,undef,undef);
- is ($sth, undef, 'DB handle method "statistics_info" returns undef: no
table');
+## Invalid table
+$sth = $dbh->statistics_info(undef,undef,'dbd_pg_test9',undef,undef);
+is ($sth, undef, 'DB handle method "statistics_info" returns undef: bad
table');
- ## Invalid table
- $sth = $dbh->statistics_info(undef,undef,'dbd_pg_test9',undef,undef);
- is ($sth, undef, 'DB handle method "statistics_info" returns undef: bad
table');
-
- ## Create some tables with various indexes
- {
- local $SIG{__WARN__} = sub {};
- $dbh->do("CREATE TABLE $table1 (a INT, b INT NOT NULL, c INT
NOT NULL, ".
- 'CONSTRAINT dbd_pg_test1_pk PRIMARY KEY (a))');
- $dbh->do("ALTER TABLE $table1 ADD CONSTRAINT dbd_pg_test1_uc1
UNIQUE (b)");
- $dbh->do("CREATE UNIQUE INDEX dbd_pg_test1_index_c ON
$table1(c)");
- $dbh->do("CREATE TABLE $table2 (a INT, b INT, c INT, PRIMARY
KEY(a,b), UNIQUE(b,c))");
- $dbh->do("CREATE INDEX dbd_pg_test2_skipme ON
$table2(c,(a+b))");
- $dbh->do("CREATE TABLE $table3 (a INT, b INT, c INT, PRIMARY
KEY(a)) WITH OIDS");
- $dbh->do("CREATE UNIQUE INDEX dbd_pg_test3_index_b ON
$table3(b)");
- $dbh->do("CREATE INDEX dbd_pg_test3_index_c ON $table3 USING
hash(c)");
- $dbh->do("CREATE INDEX dbd_pg_test3_oid ON $table3(oid)");
- $dbh->do("CREATE UNIQUE INDEX dbd_pg_test3_pred ON $table3(c)
WHERE c > 0 AND c < 45");
- $dbh->commit();
- }
+## Create some tables with various indexes
+{
+ local $SIG{__WARN__} = sub {};
+ $dbh->do("CREATE TABLE $table1 (a INT, b INT NOT NULL, c INT NOT NULL,
".
+ 'CONSTRAINT dbd_pg_test1_pk PRIMARY KEY (a))');
+ $dbh->do("ALTER TABLE $table1 ADD CONSTRAINT dbd_pg_test1_uc1 UNIQUE
(b)");
+ $dbh->do("CREATE UNIQUE INDEX dbd_pg_test1_index_c ON $table1(c)");
+ $dbh->do("CREATE TABLE $table2 (a INT, b INT, c INT, PRIMARY KEY(a,b),
UNIQUE(b,c))");
+ $dbh->do("CREATE INDEX dbd_pg_test2_skipme ON $table2(c,(a+b))");
+ $dbh->do("CREATE TABLE $table3 (a INT, b INT, c INT, PRIMARY KEY(a))
WITH OIDS");
+ $dbh->do("CREATE UNIQUE INDEX dbd_pg_test3_index_b ON $table3(b)");
+ $dbh->do("CREATE INDEX dbd_pg_test3_index_c ON $table3 USING hash(c)");
+ $dbh->do("CREATE INDEX dbd_pg_test3_oid ON $table3(oid)");
+ $dbh->do("CREATE UNIQUE INDEX dbd_pg_test3_pred ON $table3(c) WHERE c >
0 AND c < 45");
+ $dbh->commit();
+}
- my $correct_stats = {
- one => [
+my $correct_stats = {
+one => [
[ undef, $schema, $table1, undef, undef, undef, 'table', undef, undef,
undef, '0', '0', undef ],
[ undef, $schema, $table1, '0', undef, 'dbd_pg_test1_index_c', 'btree',
1, 'c', 'A', '0', '1', undef ],
[ undef, $schema, $table1, '0', undef, 'dbd_pg_test1_pk', 'btree',
1, 'a', 'A', '0', '1', undef ],
@@ -591,57 +586,57 @@
[ undef, $schema, $table3, '0', undef, 'dbd_pg_test3_pkey', 'btree',
1, 'a', 'A', '0', '1', undef ],
[ undef, $schema, $table3, '0', undef, 'dbd_pg_test3_pred', 'btree',
1, 'c', 'A', '0', '1', '((c > 0) AND (c < 45))' ],
],
- };
+};
- ## 8.1 has differences in hash index pages
- if ($pgversion < 80109) {
- $correct_stats->{three}[5][11] = 0;
- }
+## 8.1 has differences in hash index pages
+if ($pgversion < 80109) {
+ $correct_stats->{three}[5][11] = 0;
+}
+my $stats;
+
+$sth = $dbh->statistics_info(undef,$schema,$table1,undef,undef);
+$stats = $sth->fetchall_arrayref;
+is_deeply($stats, $correct_stats->{one}, "Correct stats output for $table1");
+
+$sth = $dbh->statistics_info(undef,$schema,$table2,undef,undef);
+$stats = $sth->fetchall_arrayref;
+is_deeply($stats, $correct_stats->{two}, "Correct stats output for $table2");
+
+$sth = $dbh->statistics_info(undef,$schema,$table3,undef,undef);
+$stats = $sth->fetchall_arrayref;
+is_deeply($stats, $correct_stats->{three}, "Correct stats output for $table3");
+
+$sth = $dbh->statistics_info(undef,$schema,$table3,1,undef);
+$stats = $sth->fetchall_arrayref;
+is_deeply($stats, $correct_stats->{three_uo}, "Correct stats output for
$table3 (unique only)");
+
+{
my $stats;
- $sth = $dbh->statistics_info(undef,$schema,$table1,undef,undef);
+ $sth = $dbh->statistics_info(undef,undef,$table1,undef,undef);
$stats = $sth->fetchall_arrayref;
is_deeply($stats, $correct_stats->{one}, "Correct stats output for
$table1");
- $sth = $dbh->statistics_info(undef,$schema,$table2,undef,undef);
+ $sth = $dbh->statistics_info(undef,undef,$table2,undef,undef);
$stats = $sth->fetchall_arrayref;
is_deeply($stats, $correct_stats->{two}, "Correct stats output for
$table2");
- $sth = $dbh->statistics_info(undef,$schema,$table3,undef,undef);
+ $sth = $dbh->statistics_info(undef,undef,$table3,undef,undef);
$stats = $sth->fetchall_arrayref;
is_deeply($stats, $correct_stats->{three}, "Correct stats output for
$table3");
- $sth = $dbh->statistics_info(undef,$schema,$table3,1,undef);
+ $sth = $dbh->statistics_info(undef,undef,$table3,1,undef);
$stats = $sth->fetchall_arrayref;
is_deeply($stats, $correct_stats->{three_uo}, "Correct stats output for
$table3 (unique only)");
+}
- {
- my $stats;
-
- $sth = $dbh->statistics_info(undef,undef,$table1,undef,undef);
- $stats = $sth->fetchall_arrayref;
- is_deeply($stats, $correct_stats->{one}, "Correct stats output
for $table1");
-
- $sth = $dbh->statistics_info(undef,undef,$table2,undef,undef);
- $stats = $sth->fetchall_arrayref;
- is_deeply($stats, $correct_stats->{two}, "Correct stats output
for $table2");
-
- $sth = $dbh->statistics_info(undef,undef,$table3,undef,undef);
- $stats = $sth->fetchall_arrayref;
- is_deeply($stats, $correct_stats->{three}, "Correct stats
output for $table3");
-
- $sth = $dbh->statistics_info(undef,undef,$table3,1,undef);
- $stats = $sth->fetchall_arrayref;
- is_deeply($stats, $correct_stats->{three_uo}, "Correct stats
output for $table3 (unique only)");
- }
-
- # Clean everything up
- $dbh->do("DROP TABLE $table3");
- $dbh->do("DROP TABLE $table2");
- $dbh->do("DROP TABLE $table1");
+# Clean everything up
+$dbh->do("DROP TABLE $table3");
+$dbh->do("DROP TABLE $table2");
+$dbh->do("DROP TABLE $table1");
-} ## end of statistics_info tests
+## end of statistics_info tests
#