r55589 - in /trunk/libdbd-pg-perl: Changes META.yml Makefile.PL Pg.pm Pg.xs README SIGNATURE dbdimp.c dbdimp.h debian/changelog lib/Bundle/DBD/Pg.pm t/01connect.t t/03dbmethod.t t/06bytea.t t/12placeholders.t t/dbdpg_test_setup.pl
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Wed Apr 7 09:48:20 UTC 2010
Author: eloy
Date: Wed Apr 7 09:48:08 2010
New Revision: 55589
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=55589
Log:
new upstream version
Modified:
trunk/libdbd-pg-perl/Changes
trunk/libdbd-pg-perl/META.yml
trunk/libdbd-pg-perl/Makefile.PL
trunk/libdbd-pg-perl/Pg.pm
trunk/libdbd-pg-perl/Pg.xs
trunk/libdbd-pg-perl/README
trunk/libdbd-pg-perl/SIGNATURE
trunk/libdbd-pg-perl/dbdimp.c
trunk/libdbd-pg-perl/dbdimp.h
trunk/libdbd-pg-perl/debian/changelog
trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm
trunk/libdbd-pg-perl/t/01connect.t
trunk/libdbd-pg-perl/t/03dbmethod.t
trunk/libdbd-pg-perl/t/06bytea.t
trunk/libdbd-pg-perl/t/12placeholders.t
trunk/libdbd-pg-perl/t/dbdpg_test_setup.pl
Modified: trunk/libdbd-pg-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Changes?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Changes (original)
+++ trunk/libdbd-pg-perl/Changes Wed Apr 7 09:48:08 2010
@@ -1,11 +1,19 @@
-('GSM' is Greg Sabino Mullane, greg at turnstep.com)
-
-2.16.1 Released January 20, 2010
+'GSM' is Greg Sabino Mullane, greg at turnstep.com)
+
+2.17.0 Released April 6, 2010
+
+ - Do not automatically ROLLBACK on a failed pg_cancel [GSM] (CPAN bug #55188)
+ - Added support for new lo_import_with_oid function.
+ [GSM] (CPAN bug #53835)
+ - Don't limit stored user name to \w in tests [GSM] (CPAN bug #54372)
+ - Allow tests to support versions back to Postgres 7.4 [GSM]
+
+2.16.1 Released January 20, 2010 (subversion r13756)
- Output error messages in UTF-8 as needed. Reported by
Michael Hofmann. [GSM] (CPAN bug #53854)
-2.16.0 Released December 17, 2009
+2.16.0 Released December 17, 2009 (subversion r13672)
- Put in a test for high-bit characters in bytea handling.
[Bryce Nesbitt] (see also CPAN bug #39390)
Modified: trunk/libdbd-pg-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/META.yml?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/META.yml (original)
+++ trunk/libdbd-pg-perl/META.yml Wed Apr 7 09:48:08 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name : DBD-Pg
-version : 2.16.1
+version : 2.17.0
abstract : DBI PostgreSQL interface
author:
- Greg Sabino Mullane <greg at turnstep.com>
@@ -39,10 +39,10 @@
provides:
DBD::Pg:
file : Pg.pm
- version : 2.16.1
+ version : 2.17.0
Bundle::DBD::Pg:
file : lib/Bundle/DBD/Pg.pm
- version : 2.16.1
+ version : 2.17.0
keywords:
- Postgres
Modified: trunk/libdbd-pg-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Makefile.PL?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Makefile.PL (original)
+++ trunk/libdbd-pg-perl/Makefile.PL Wed Apr 7 09:48:08 2010
@@ -1,4 +1,4 @@
-# $Id: Makefile.PL 13751 2010-01-20 19:14:51Z turnstep $
+# $Id: Makefile.PL 13885 2010-04-05 19:45:08Z turnstep $
use ExtUtils::MakeMaker;
use Config;
@@ -7,7 +7,7 @@
use 5.006001;
## No version.pm for this one, as the prereqs are not loaded yet.
-my $VERSION = '2.16.1';
+my $VERSION = '2.17.0';
my $lib;
BEGIN {
Modified: trunk/libdbd-pg-perl/Pg.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Pg.pm?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Pg.pm (original)
+++ trunk/libdbd-pg-perl/Pg.pm Wed Apr 7 09:48:08 2010
@@ -1,5 +1,5 @@
# -*-cperl-*-
-# $Id: Pg.pm 13752 2010-01-20 19:19:06Z turnstep $
+# $Id: Pg.pm 13885 2010-04-05 19:45:08Z turnstep $
#
# Copyright (c) 2002-2010 Greg Sabino Mullane and others: see the Changes file
# Portions Copyright (c) 2002 Jeffrey W. Baker
@@ -17,7 +17,7 @@
{
package DBD::Pg;
- use version; our $VERSION = qv('2.16.1');
+ use version; our $VERSION = qv('2.17.0');
use DBI ();
use DynaLoader ();
@@ -152,6 +152,7 @@
DBD::Pg::db->install_method('pg_lo_close');
DBD::Pg::db->install_method('pg_lo_unlink');
DBD::Pg::db->install_method('pg_lo_import');
+ DBD::Pg::db->install_method('pg_lo_import_with_oid');
DBD::Pg::db->install_method('pg_lo_export');
return $drh;
@@ -1731,7 +1732,7 @@
=head1 VERSION
-This documents version 2.16.1 of the DBD::Pg module
+This documents version 2.17.0 of the DBD::Pg module
=head1 DESCRIPTION
@@ -2147,6 +2148,18 @@
Imports a Unix file as a large object and returns the object id of the new
object or C<undef> upon failure.
+
+=item lo_import_with_oid
+
+
+ $lobjId = $dbh->pg_lo_import($filename, $OID);
+
+Same as lo_import, but attempts to use the supplied OID as the
+large object number. If this number is 0, it falls back to the
+behavior of lo_import (which assigns the next available OID).
+
+This is only available when DBD::Pg is compiled against a Postgres
+server version 8.4 or later.
=item lo_export
@@ -2743,7 +2756,7 @@
}
Payloads will always be an empty string unless you are connecting to a Postgres
-server version 8.5 or higher.
+server version 9.0 or higher.
=head3 B<ping>
@@ -3896,8 +3909,9 @@
This database-level method attempts to cancel any currently running asynchronous query. It returns true if
the cancel succeeded, and false otherwise. Note that a query that has finished before this method is executed
-will also return false. B<WARNING>: a successful cancellation will leave the database in an unusable state,
-so DBD::Pg will automatically clear out the error message and issue a ROLLBACK.
+will also return false. B<WARNING>: a successful cancellation may leave the database in an unusable state,
+so you may need to ROLLBACK or ROLLBACK TO a savepoint. As of version 2.17.0 of DBD::Pg, rollbacks are
+not done automatically.
$result = $dbh->pg_cancel();
@@ -4106,7 +4120,7 @@
=head2 Large Objects
DBD::Pg supports all largeobject functions provided by libpq via the
-C<func> method. Please note that access to a large object, even read-only
+C<< $dbh->pg_lo* >> methods. Please note that access to a large object, even read-only
large objects, must be put into a transaction.
=head2 Cursors
Modified: trunk/libdbd-pg-perl/Pg.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Pg.xs?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Pg.xs (original)
+++ trunk/libdbd-pg-perl/Pg.xs Wed Apr 7 09:48:08 2010
@@ -1,5 +1,5 @@
/*
- $Id: Pg.xs 13752 2010-01-20 19:19:06Z turnstep $
+ $Id: Pg.xs 13758 2010-01-20 21:14:28Z turnstep $
Copyright (c) 2000-2010 Greg Sabino Mullane and others: see the Changes file
Portions Copyright (c) 1997-2000 Edmund Mergl
@@ -481,6 +481,17 @@
void
+pg_lo_import_with_oid(dbh, filename, lobjId)
+ SV * dbh
+ char * filename
+ unsigned int lobjId
+ CODE:
+ const unsigned int ret = (lobjId==0) ? pg_db_lo_import(dbh, filename)
+ : pg_db_lo_import_with_oid(dbh, filename, lobjId);
+ ST(0) = (ret > 0) ? sv_2mortal(newSVuv(ret)) : &PL_sv_undef;
+
+
+void
pg_lo_export(dbh, lobjId, filename)
SV * dbh
unsigned int lobjId
Modified: trunk/libdbd-pg-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/README?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/README (original)
+++ trunk/libdbd-pg-perl/README Wed Apr 7 09:48:08 2010
@@ -6,7 +6,7 @@
DESCRIPTION:
------------
-This is version 2.16.1 of DBD::Pg, the Perl interface to Postgres using DBI.
+This is version 2.17.0 of DBD::Pg, the Perl interface to Postgres using DBI.
The web site for this interface, and the latest version, can be found at:
http://search.cpan.org/dist/DBD-Pg/
Modified: trunk/libdbd-pg-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/SIGNATURE?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/SIGNATURE (original)
+++ trunk/libdbd-pg-perl/SIGNATURE Wed Apr 7 09:48:08 2010
@@ -15,42 +15,42 @@
Hash: RIPEMD160
SHA1 415d25a8628815a50a8f79317de4abff11ac73e8 .perlcriticrc
-SHA1 61ababe84bab1f17beffd7fc9f712a3f76859bd9 Changes
+SHA1 66a7d35804d992c59064d352c730f1b677db6776 Changes
SHA1 21bc5f3c797d4d5b72285198ffeb1e4e1f0a2902 LICENSES/artistic.txt
SHA1 06877624ea5c77efe3b7e39b0f909eda6e25a4ec LICENSES/gpl-2.0.txt
SHA1 4025b3973c4a10c37fc7ad2f7a63fd9faa36f599 MANIFEST
SHA1 dc863ce481b321833db84c95bbe976e8c65f296e MANIFEST.SKIP
-SHA1 68c6a46d1ee510f2d24979150c8c21935a207a02 META.yml
-SHA1 34de4fefe6a7e6d91d31ca2cde46561dca9f9748 Makefile.PL
+SHA1 3355b6870902376b29abeea2f88f38f1f2cbfaa0 META.yml
+SHA1 f8c9acd2062dfab03b9ecc19be4c0c727489c6d6 Makefile.PL
SHA1 85c2b29c21312a022524a730f26b2c4b30fc4211 Pg.h
-SHA1 38b622161de0aa97a6f832069f226f89b968a3c9 Pg.pm
-SHA1 526e543d114e0448343e0f7b7f516489b27a7eff Pg.xs
-SHA1 20c1143b25d5391047bda462af408a8b59c5f124 README
+SHA1 5f1bc482ad0f3dc09fb8e6bea11859ee77d7a798 Pg.pm
+SHA1 4a89e8770e3b1e83cee5150b1b5daa32e099d1b0 Pg.xs
+SHA1 b1687af059e33159708c4db10e25ce6664e6d857 README
SHA1 4078d5452d087f83c7f43915fd329a51e66b0f6a README.dev
SHA1 7e213bf90f513595b59c0a2c4ef94fea1592efcf README.win32
SHA1 7330c41dd3a581aee4e1ca862b7403450454ce77 TODO
-SHA1 3377518030d81cd77473955f7ece656a80b7b151 dbdimp.c
-SHA1 2dbe05ed5fd97aca5d5e06eafd5e3d0b0ad408bd dbdimp.h
+SHA1 5f9c6d5446e0d7273e0fbb33e57bce5198596492 dbdimp.c
+SHA1 778794bc7eea7ad15ed3e933eb98f1e1e9875ec4 dbdimp.h
SHA1 6c33bcf138e577722283bef02fceb8cbce4d100d dbivport.h
-SHA1 41e743c30b6bc555a0b32eb2e010d3133a6fd4ce lib/Bundle/DBD/Pg.pm
+SHA1 f340b6d0c470e615ca608420be039c7b87aa9061 lib/Bundle/DBD/Pg.pm
SHA1 11dc1f05bf7dc7e97d2ffe4796367506a0f86c9d quote.c
SHA1 54f10c6d76db2f2bfbaa7f345d7034029b88453c quote.h
SHA1 93aa7e8cae0a361d1e6163dea0281ebff41f3c5f t/00-signature.t
SHA1 073baf503a601ceeb49516d61bd275f0c1e51563 t/00basic.t
-SHA1 f407ad828fe5898e1fa585523852b204ce9b5b2d t/01connect.t
+SHA1 84fdf16d76249725a42a06916ec9550d1ea30538 t/01connect.t
SHA1 1e0d8cad9de0063d4258739f6c8eb2cee27d9937 t/01constants.t
SHA1 01f352b31c7d68eeb09cf3b65a88cb09d95af341 t/02attribs.t
-SHA1 102de1d793ed8ee9f6c11b6a64d1b9f6fb54f147 t/03dbmethod.t
+SHA1 ae6cc3d2c6965ba03a0da89c50f26e7aa613de5f t/03dbmethod.t
SHA1 56c1dbf645c0849ad10ec7fc9542a4a4bed11f47 t/03smethod.t
SHA1 910d6c2234d77a74a49cf189b6c799e13bf75280 t/04misc.t
-SHA1 3bdff339d707130208e2e9fa216f7f7037983754 t/06bytea.t
+SHA1 b49f2234aa5070ab5b5020e5eae67eb1967facb0 t/06bytea.t
SHA1 e55c0c4bf65b8d25dff7b7c9fed429fb8d07259b t/07copy.t
SHA1 3aa283c6065bc2a7b734fc4c7d1f21ac79acfdde t/08async.t
SHA1 dbbb66906bed8f24879ad757e58be889ac4cee4d t/09arrays.t
-SHA1 fad986d7f22e33107fb1fe5db18a3c435ebbb240 t/12placeholders.t
+SHA1 8166901700f235266adee5ad12d76ebe6f00cf3d t/12placeholders.t
SHA1 85b5df8ef0c78b1d2d0018d874c62af7ef01a28f t/20savepoints.t
SHA1 35e3cc228bb48e23a5f1ef74d10a78b87ec64b73 t/99cleanup.t
-SHA1 b530865b212e34318a0cfbb7b9057a9491a0bf38 t/dbdpg_test_setup.pl
+SHA1 7558842ed61067efcbc7065f72c808f63c689238 t/dbdpg_test_setup.pl
SHA1 30b4c1b0a41123bbbdc690588a2fdb319023bf0c t/lib/App/Info.pm
SHA1 94cd383136553746ff12128aa367fb71e98087df t/lib/App/Info/Handler.pm
SHA1 b5bf85b12a5fc207c44113a9c028fb7fbd68531f t/lib/App/Info/Handler/Prompt.pm
@@ -63,7 +63,7 @@
SHA1 f07cd5ecaeb854c81ceb9206364979cf607e6546 win32.mak
-----BEGIN PGP SIGNATURE-----
-iEYEAREDAAYFAktXb8wACgkQvJuQZxSWSshKoQCgwuI9VmfTr8S0s1Y/Y85dHba0
-np4An1DLbA6LMbBZgTILSwgCNruT+vHc
-=K99o
+iEYEAREDAAYFAku7gsoACgkQvJuQZxSWSsgUZQCeJUNLurguxHoIC2DTtaWYVrMx
+qJkAnilHrJtkTLqvdzFMBr28g6XUWfTB
+=mZTc
-----END PGP SIGNATURE-----
Modified: trunk/libdbd-pg-perl/dbdimp.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/dbdimp.c?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/dbdimp.c (original)
+++ trunk/libdbd-pg-perl/dbdimp.c Wed Apr 7 09:48:08 2010
@@ -1,6 +1,6 @@
/*
- $Id: dbdimp.c 13752 2010-01-20 19:19:06Z turnstep $
+ $Id: dbdimp.c 13883 2010-04-05 19:08:17Z turnstep $
Copyright (c) 2002-2010 Greg Sabino Mullane and others: see the Changes file
Portions Copyright (c) 2002 Jeffrey W. Baker
@@ -4414,6 +4414,34 @@
}
/* ================================================================== */
+unsigned int pg_db_lo_import_with_oid (SV * dbh, char * filename, unsigned int lobjId)
+{
+
+ Oid loid;
+ dTHX;
+ D_imp_dbh(dbh);
+
+ if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_import_with_oid (filename: %s, oid: %d)\n",
+ THEADER, filename, lobjId);
+
+ if (!pg_db_start_txn(aTHX_ dbh,imp_dbh))
+ return 0; /* No other option, because lo_import* returns an Oid */
+
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_import_with_oid\n", THEADER);
+ }
+ loid = lo_import_with_oid(imp_dbh->conn, filename, lobjId); /* 0 on error */
+
+ if (DBIc_has(imp_dbh, DBIcf_AutoCommit)) {
+ if (!pg_db_end_txn(aTHX_ dbh, imp_dbh, 0==loid ? 0 : 1))
+ return 0;
+ }
+
+ return loid;
+
+}
+
+/* ================================================================== */
int pg_db_lo_export (SV * dbh, unsigned int lobjId, char * filename)
{
@@ -4678,10 +4706,8 @@
/*
Attempt to cancel a running asynchronous query
Returns true if the cancel succeeded, and false if it did not
-If it did successfully cancel the query, it will also do a rollback.
-Note that queries which have finished do not cause a rollback.
In this case, pg_cancel will return false.
-NOTE: We only return true if we cancelled and rolled back!
+NOTE: We only return true if we cancelled
*/
/* ================================================================== */
@@ -4741,11 +4767,9 @@
status = _sqlstate(aTHX_ imp_dbh, result);
- /* If we actually cancelled a running query, perform a rollback */
+ /* If we actually cancelled a running query, just return true - the caller must rollback if needed */
if (0 == strncmp(imp_dbh->sqlstate, "57014", 5)) {
- if (TRACE3) { TRC(DBILOGFP, "%sRolling back after cancelled query\n", THEADER); }
- dbd_db_rollback(h, imp_dbh);
- if (TEND) TRC(DBILOGFP, "%sEnd pg_db_cancel (rollback)\n", THEADER);
+ if (TEND) TRC(DBILOGFP, "%sEnd pg_db_cancel\n", THEADER);
return DBDPG_TRUE;
}
Modified: trunk/libdbd-pg-perl/dbdimp.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/dbdimp.h?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/dbdimp.h (original)
+++ trunk/libdbd-pg-perl/dbdimp.h Wed Apr 7 09:48:08 2010
@@ -1,5 +1,5 @@
/*
- $Id: dbdimp.h 13752 2010-01-20 19:19:06Z turnstep $
+ $Id: dbdimp.h 13758 2010-01-20 21:14:28Z turnstep $
Copyright (c) 2000-2010 Greg Sabino Mullane and others: see the Changes file
Portions Copyright (c) 1997-2000 Edmund Mergl
@@ -231,6 +231,8 @@
unsigned int pg_db_lo_import (SV *dbh, char *filename);
+unsigned int pg_db_lo_import_with_oid (SV *dbh, char *filename, unsigned int lobjId);
+
int pg_db_lo_export (SV *dbh, unsigned int lobjId, char *filename);
int pg_db_result (SV *h, imp_dbh_t *imp_dbh);
Modified: trunk/libdbd-pg-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/debian/changelog?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/debian/changelog (original)
+++ trunk/libdbd-pg-perl/debian/changelog Wed Apr 7 09:48:08 2010
@@ -1,3 +1,9 @@
+libdbd-pg-perl (2.17.0-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Krzysztof Krzyżaniak (eloy) <eloy at debian.org> Wed, 07 Apr 2010 11:45:46 +0200
+
libdbd-pg-perl (2.16.1-1) unstable; urgency=low
[ Jonathan Yu ]
Modified: trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm (original)
+++ trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm Wed Apr 7 09:48:08 2010
@@ -4,7 +4,7 @@
use strict;
use warnings;
-$VERSION = '2.16.1';
+$VERSION = '2.17.0';
1;
Modified: trunk/libdbd-pg-perl/t/01connect.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/t/01connect.t?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/t/01connect.t (original)
+++ trunk/libdbd-pg-perl/t/01connect.t Wed Apr 7 09:48:08 2010
@@ -39,6 +39,9 @@
$t=q{Second database connection attempt worked};
(undef,$connerror,$dbh) = connect_database();
is ($connerror, '', $t);
+if ($connerror ne '') {
+ BAIL_OUT 'Second connection to database failed, bailing out';
+}
## Grab some important values used for debugging
my @vals = qw/array_nulls backslash_quote server_encoding client_encoding standard_conforming_strings/;
Modified: trunk/libdbd-pg-perl/t/03dbmethod.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/t/03dbmethod.t?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/t/03dbmethod.t (original)
+++ trunk/libdbd-pg-perl/t/03dbmethod.t Wed Apr 7 09:48:08 2010
@@ -26,7 +26,7 @@
if (! defined $dbh) {
plan skip_all => 'Connection to database failed, cannot continue testing';
}
-plan tests => 524;
+plan tests => 529;
isnt ($dbh, undef, 'Connect to database for database handle method testing');
@@ -1400,12 +1400,14 @@
ok (!$result, $t);
$dbh->rollback();
+my $abctext = $pgversion >= 80500 ? 'x6162630a646566' : "abc\ndef";
+
SKIP: {
eval {
require File::Temp;
};
- $@ and skip ('Must have File::Temp to test pg_lo_import and pg_lo_export', 8);
+ $@ and skip ('Must have File::Temp to test pg_lo_import* and pg_lo_export', 8);
$t='DB handle method "pg_lo_import" works';
my ($fh,$filename) = File::Temp::tmpnam();
@@ -1414,12 +1416,49 @@
$handle = $dbh->pg_lo_import($filename);
my $objid = $handle;
ok ($handle, $t);
- unlink $filename;
$t='DB handle method "pg_lo_import" inserts correct data';
$SQL = "SELECT data FROM pg_largeobject where loid = $handle";
$info = $dbh->selectall_arrayref($SQL)->[0][0];
- is_deeply ($info, "abc\ndef", $t);
+ is_deeply ($info, $abctext, $t);
+ $dbh->commit();
+
+ SKIP: {
+ if ($pglibversion < 80400) {
+ skip ('Cannot test pg_lo_import_with_oid unless compiled against 8.4 or better server', 5);
+ }
+ if ($pgversion < 80100) {
+ skip ('Cannot test pg_lo_import_with_oid against old versions of Postgres', 5);
+ }
+
+ $t='DB handle method "pg_lo_import_with_oid" works with high number';
+ my $highnumber = 345167;
+ $dbh->pg_lo_unlink($highnumber);
+ $dbh->commit();
+ my $thandle = $dbh->pg_lo_import_with_oid($filename, $highnumber);
+ is ($thandle, $highnumber, $t);
+ ok ($thandle, $t);
+
+ $t='DB handle method "pg_lo_import_with_oid" inserts correct data';
+ $SQL = "SELECT data FROM pg_largeobject where loid = $thandle";
+ $info = $dbh->selectall_arrayref($SQL)->[0][0];
+ is_deeply ($info, $abctext, $t);
+
+ $t='DB handle method "pg_lo_import_with_oid" fails when given already used number';
+ eval {
+ $thandle = $dbh->pg_lo_import_with_oid($filename, $objid);
+ };
+ is ($thandle, undef, $t);
+ $dbh->rollback();
+
+ $t='DB handle method "pg_lo_import_with_oid" falls back to lo_import when number is 0';
+ eval {
+ $thandle = $dbh->pg_lo_import_with_oid($filename, 0);
+ };
+ ok ($thandle, $t);
+ }
+
+ unlink $filename;
$t='DB handle method "pg_lo_open" works after "pg_lo_insert"';
$handle = $dbh->pg_lo_open($handle, $R);
@@ -1517,7 +1556,7 @@
$sth = $dbh->prepare($SQL);
$sth->execute($handle);
$info = $sth->fetchall_arrayref()->[0][0];
- is_deeply ($info, "abc\ndef", $t);
+ is_deeply ($info, $abctext, $t);
$t='DB handle method "pg_lo_import" works (AutoCommit on, begin_work called, no command)';
$dbh->begin_work();
@@ -1525,7 +1564,7 @@
ok ($handle, $t);
$sth->execute($handle);
$info = $sth->fetchall_arrayref()->[0][0];
- is_deeply ($info, "abc\ndef", $t);
+ is_deeply ($info, $abctext, $t);
$dbh->rollback();
$t='DB handle method "pg_lo_import" works (AutoCommit on, begin_work called, no command, rollback)';
@@ -1544,7 +1583,7 @@
ok ($handle, $t);
$sth->execute($handle);
$info = $sth->fetchall_arrayref()->[0][0];
- is_deeply ($info, "abc\ndef", $t);
+ is_deeply ($info, $abctext, $t);
$dbh->rollback();
$t='DB handle method "pg_lo_import" works (AutoCommit on, begin_work called, second command, rollback)';
@@ -1564,7 +1603,7 @@
ok ($handle, $t);
$sth->execute($handle);
$info = $sth->fetchall_arrayref()->[0][0];
- is_deeply ($info, "abc\ndef", $t);
+ is_deeply ($info, $abctext, $t);
$t='DB handle method "pg_lo_import" works (AutoCommit not on, second command)';
$dbh->rollback();
@@ -1573,7 +1612,7 @@
ok ($handle, $t);
$sth->execute($handle);
$info = $sth->fetchall_arrayref()->[0][0];
- is_deeply ($info, "abc\ndef", $t);
+ is_deeply ($info, $abctext, $t);
unlink $filename;
$dbh->{AutoCommit} = 1;
Modified: trunk/libdbd-pg-perl/t/06bytea.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/t/06bytea.t?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/t/06bytea.t (original)
+++ trunk/libdbd-pg-perl/t/06bytea.t Wed Apr 7 09:48:08 2010
@@ -23,7 +23,11 @@
my ($pglibversion,$pgversion) = ($dbh->{pg_lib_version},$dbh->{pg_server_version});
if ($pgversion >= 80100) {
- $dbh->do('SET escape_string_warning = false');
+ $dbh->do('SET escape_string_warning = false');
+}
+
+if ($pgversion >= 90000) {
+ $dbh->do(q{SET bytea_output = 'escape'});
}
my ($sth, $t);
Modified: trunk/libdbd-pg-perl/t/12placeholders.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/t/12placeholders.t?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/t/12placeholders.t (original)
+++ trunk/libdbd-pg-perl/t/12placeholders.t Wed Apr 7 09:48:08 2010
@@ -506,6 +506,9 @@
};
is ($@, q{}, $t);
+SKIP: {
+ skip 'Cannot run some quote tests on very old versions of Postgres', 14 if $pgversion < 80000;
+
$t='Prepare works with placeholders after double slashes';
eval {
$dbh->do(q{CREATE OPERATOR // ( PROCEDURE=bit, LEFTARG=int, RIGHTARG=int )});
@@ -542,6 +545,8 @@
$sth->finish();
};
is ($@, q{}, $t);
+}
+
}
SKIP: {
Modified: trunk/libdbd-pg-perl/t/dbdpg_test_setup.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/t/dbdpg_test_setup.pl?rev=55589&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/t/dbdpg_test_setup.pl (original)
+++ trunk/libdbd-pg-perl/t/dbdpg_test_setup.pl Wed Apr 7 09:48:08 2010
@@ -63,7 +63,8 @@
## We'll try various ways to get to a database to test with
## First, check to see if we've been here before and left directions
- my ($testdsn,$testuser,$helpconnect,$su,$uid,$testdir,$pg_ctl,$initdb,$error) = get_test_settings();
+ my ($testdsn,$testuser,$helpconnect,$su,$uid,$testdir,$pg_ctl,$initdb,$error,$version)
+ = get_test_settings();
## Did we fail last time? Fail this time too, but quicker!
if ($testdsn =~ /FAIL!/) {
@@ -131,6 +132,9 @@
}
}
$option = q{-o '-k socket'};
+ if ($version <= 8.0) {
+ $option = q{-o '-k dbdpg_test_database/data/socket'};
+ }
}
my $COM = qq{$pg_ctl $option -l $testdir/dbdpg_test.logfile -D $testdir/data start};
if ($su) {
@@ -245,10 +249,11 @@
$ENV{LANG} = 'C';
$info = '';
eval {
- $info = qx{$initdb --help 2>&1};
+ $info = qx{$initdb --version 2>&1};
};
last GETHANDLE if $@; ## Fail - initdb bad
- if (!defined $info or ($info !~ /\@postgresql\.org/ and $info !~ /run as root/)) {
+ $version = 0;
+ if (!defined $info or ($info !~ /(Postgres)/i and $info !~ /run as root/)) {
if (defined $info) {
if ($info !~ /\w/) {
$@ = 'initdb not found: cannot run full tests without a Postgres database';
@@ -264,6 +269,12 @@
$@ = $msg;
}
last GETHANDLE; ## Fail - initdb bad
+ }
+ elsif ($info =~ /(\d+\.\d+)/) {
+ $version = $1;
+ }
+ else {
+ die "No version from initdb?! ($info)\n";
}
## Make sure pg_ctl is available as well before we go further
@@ -401,8 +412,20 @@
print $cfh "\n\n## DBD::Pg testing parameters\n";
print $cfh "port=$testport\n";
print $cfh "max_connections=4\n";
- print $cfh "log_statement = 'all'\n";
- print $cfh "log_line_prefix = '%m [%p] '\n";
+ if ($version >= 8.0) {
+ print $cfh "log_statement = 'all'\n";
+ print $cfh "log_line_prefix = '%m [%p] '\n";
+ }
+ else {
+ print $cfh "silent_mode = true\n";
+ }
+ if ($version == 8.1) {
+ print {$cfh} "redirect_stderr = on\n";
+ }
+
+ if ($version >= 8.3) {
+ print {$cfh} "logging_collector = on\n";
+ }
print $cfh "log_min_messages = 'DEBUG1'\n";
print $cfh "listen_addresses='127.0.0.1'\n" if $^O =~ /Win32/;
print $cfh "\n";
@@ -426,6 +449,9 @@
}
}
$option = q{-o '-k socket'};
+ if ($version <= 8.0) {
+ $option = q{-o '-k dbdpg_test_database/data/socket'};
+ }
}
my $COM = qq{$pg_ctl $option -l $testdir/dbdpg_test.logfile -D $testdir/data start};
$olddir = getcwd;
@@ -453,6 +479,7 @@
else {
$testdsn .= ";host=$testdir/data/socket";
}
+
my $loop = 1;
STARTUP: {
eval {
@@ -461,7 +488,22 @@
};
## Regardless of the error, try again.
## We used to check the message, but LANG problems may complicate that.
+
if ($@) {
+ if ($@ =~ /database "postgres" does not exist/) {
+ ## Old server, so let's create a postgres database manually
+ sleep 2;
+ (my $tempdsn = $testdsn) =~ s/postgres/template1/;
+ eval {
+ $dbh = DBI->connect($tempdsn, $testuser, '',
+ {RaiseError => 1, PrintError => 0, AutoCommit => 1});
+ };
+ $dbh->do('CREATE DATABASE postgres');
+ $dbh->disconnect();
+ if ($@) {
+ die "Could not connect: $@\n";
+ }
+ }
if ($loop++ < 5) {
sleep 1;
redo STARTUP;
@@ -483,6 +525,7 @@
print $fh "## Helpconnect: $helpconnect\n";
print $fh "## pg_ctl: $pg_ctl\n";
print $fh "## initdb: $initdb\n";
+ print $fh "## Version: $version\n";
if ($connerror) {
print $fh "## DSN: FAIL!\n";
print $fh "## ERROR: $connerror\n";
@@ -592,7 +635,7 @@
sub get_test_settings {
- ## Returns test databae information from the testfile if it exists
+ ## Returns test database information from the testfile if it exists
## Defaults to ENV variables or blank
## Find the best candidate for the pg_ctl program
@@ -601,7 +644,7 @@
($pg_ctl = $ENV{PGINITDB}) =~ s/initdb/pg_ctl/;
}
my ($testdsn, $testuser, $testdir, $error) = ('','','','?');
- my ($helpconnect, $su, $uid, $initdb) = (0,'','','default');
+ my ($helpconnect, $su, $uid, $initdb, $version) = (0,'','','default',0);
my $inerror = 0;
if (-e $helpfile) {
open $fh, '<', $helpfile or die qq{Could not open "$helpfile": $!\n};
@@ -610,7 +653,7 @@
$error .= "\n$_";
}
/DSN: (.+)/ and $testdsn = $1;
- /User: (\w+)/ and $testuser = $1;
+ /User: (\S+)/ and $testuser = $1;
/Helpconnect: (\d+)/ and $helpconnect = $1;
/Testowner: (\w+)/ and $su = $1;
/Testowneruid: (\d+)/ and $uid = $1;
@@ -618,6 +661,7 @@
/pg_ctl: (.+)/ and $pg_ctl = $1;
/initdb: (.+)/ and $initdb = $1;
/ERROR: (.+)/ and $error = $1 and $inerror = 1;
+ /Version: (.+)/ and $version = $1;
}
close $fh or die qq{Could not close "$helpfile": $!\n};
}
@@ -627,7 +671,7 @@
$testdir = "$dir/dbdpg_test_database";
}
- return $testdsn, $testuser, $helpconnect, $su, $uid, $testdir, $pg_ctl, $initdb, $error;
+ return $testdsn, $testuser, $helpconnect, $su, $uid, $testdir, $pg_ctl, $initdb, $error, $version;
} ## end of get_test_settings
More information about the Pkg-perl-cvs-commits
mailing list