r28268 - in /trunk/libdbd-pg-perl: Changes META.yml Makefile.PL Pg.pm README SIGNATURE dbdimp.c debian/changelog lib/Bundle/DBD/Pg.pm t/12placeholders.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Mon Dec 15 19:13:20 UTC 2008


Author: gregoa
Date: Mon Dec 15 19:13:16 2008
New Revision: 28268

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28268
Log:
New upstream release.

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/README
    trunk/libdbd-pg-perl/SIGNATURE
    trunk/libdbd-pg-perl/dbdimp.c
    trunk/libdbd-pg-perl/debian/changelog
    trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm
    trunk/libdbd-pg-perl/t/12placeholders.t

Modified: trunk/libdbd-pg-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Changes?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Changes (original)
+++ trunk/libdbd-pg-perl/Changes Mon Dec 15 19:13:16 2008
@@ -1,6 +1,10 @@
 ('GSM' is Greg Sabino Mullane, greg at turnstep.com)
 
-2.11.6 Released November 30, 2008
+2.11.7 Released December 13, 2008
+
+  - Fix placeholder parsing logic (CPAN bug #41582)
+
+2.11.6 Released November 30, 2008 (subversion r12126)
 
   - Only set UTF8 flag on array items after UTF8 test. (CPAN bug #41253)
     [Armando Santos]

Modified: trunk/libdbd-pg-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/META.yml?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/META.yml (original)
+++ trunk/libdbd-pg-perl/META.yml Mon Dec 15 19:13:16 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name                        : DBD-Pg
-version                     : 2.11.6
+version                     : 2.11.7
 abstract                    : DBI PostgreSQL interface
 author:              
   - Greg Sabino Mullane <greg at turnstep.com>
@@ -39,10 +39,10 @@
 provides:
   DBD::Pg:
     file                    : Pg.pm
-    version                 : 2.11.6
+    version                 : 2.11.7
   Bundle::DBD::Pg:
     file                    : lib/Bundle/DBD/Pg.pm
-    version                 : 2.11.6
+    version                 : 2.11.7
 
 keywords:
   - Postgres

Modified: trunk/libdbd-pg-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Makefile.PL?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Makefile.PL (original)
+++ trunk/libdbd-pg-perl/Makefile.PL Mon Dec 15 19:13:16 2008
@@ -1,4 +1,4 @@
-# $Id: Makefile.PL 12120 2008-11-30 22:09:04Z turnstep $
+# $Id: Makefile.PL 12157 2008-12-13 16:58:36Z 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.11.6';
+my $VERSION = '2.11.7';
 
 my $lib;
 BEGIN {
@@ -77,14 +77,19 @@
 my ($major_ver, $minor_ver, $patch, $conf, $bindir) = map {$pg->$_}
 	qw/major_version minor_version patch_version configure bin_dir/;
 my $initdb = '';
-if (-d $bindir) {
+if (defined $bindir and -d $bindir) {
 	my $testinitdb = "$bindir${sep}initdb";
 	if (-e $testinitdb) {
 		$initdb = $testinitdb;
 	}
 }
-my $serverversion = sprintf '%d%.02d%.02d', $major_ver, $minor_ver, $patch;
-my $defaultport = $conf =~ /with-pgport=(\d+)/ ? $1 : 5432;
+my $serverversion = 0;
+my $defaultport = 0;
+
+if (defined $major_ver) {
+	$serverversion = sprintf '%d%.02d%.02d', $major_ver, $minor_ver, $patch;
+	$defaultport = $conf =~ /with-pgport=(\d+)/ ? $1 : 5432;
+}
 
 if ((!$ENV{POSTGRES_INCLUDE} or !$ENV{POSTGRES_LIB}) and !$ENV{POSTGRES_HOME}) {
     $POSTGRES_INCLUDE = $pg->inc_dir;

Modified: trunk/libdbd-pg-perl/Pg.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/Pg.pm?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/Pg.pm (original)
+++ trunk/libdbd-pg-perl/Pg.pm Mon Dec 15 19:13:16 2008
@@ -1,5 +1,5 @@
 #  -*-cperl-*-
-#  $Id: Pg.pm 12120 2008-11-30 22:09:04Z turnstep $
+#  $Id: Pg.pm 12157 2008-12-13 16:58:36Z turnstep $
 #
 #  Copyright (c) 2002-2008 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.11.6');
+	use version; our $VERSION = qv('2.11.7');
 
 	use DBI ();
 	use DynaLoader ();
@@ -1703,7 +1703,7 @@
 
 =head1 VERSION
 
-This documents version 2.11.6 of the DBD::Pg module
+This documents version 2.11.7 of the DBD::Pg module
 
 =head1 DESCRIPTION
 

Modified: trunk/libdbd-pg-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/README?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/README (original)
+++ trunk/libdbd-pg-perl/README Mon Dec 15 19:13:16 2008
@@ -1,12 +1,12 @@
 
 DBD::Pg  --  the DBI PostgreSQL interface for Perl
 
-# $Id: README 12120 2008-11-30 22:09:04Z turnstep $
+# $Id: README 12157 2008-12-13 16:58:36Z turnstep $
 
 DESCRIPTION:
 ------------
 
-This is version 2.11.6 of DBD::Pg, the Perl interface to Postgres using DBI. 
+This is version 2.11.7 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=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/SIGNATURE (original)
+++ trunk/libdbd-pg-perl/SIGNATURE Mon Dec 15 19:13:16 2008
@@ -15,22 +15,22 @@
 Hash: RIPEMD160
 
 SHA1 2f324889a0b126216bf45a04d74803557c4a404e .perlcriticrc
-SHA1 a8a8e98762d241812364b639e44d354c6bc9fb5e Changes
+SHA1 b76de2d63c091ed89270c2086ff0e4ebfd6c2802 Changes
 SHA1 4d91c71e5dbb19ece1505ab75c36d00a744bb076 MANIFEST
 SHA1 6fd98d850a9a67911c047e7f0a8752fd15be98d7 MANIFEST.SKIP
-SHA1 36da1602f9990d293273c9f72f34efb47408499a META.yml
-SHA1 594c125eddba373d6fc0c994a4cca9fc9edbcd31 Makefile.PL
+SHA1 59e79c2f4bf6177f2442a82f3276e74dcff630b6 META.yml
+SHA1 10ed04aa160d2ab23b0e399c22dc0b34167cdb60 Makefile.PL
 SHA1 c51356c52c139265e20a2ad33bc8d3ee04f6ff48 Pg.h
-SHA1 87d9edb74d30d5934e8a7a4a02b17f48c0b2f921 Pg.pm
+SHA1 4ee9b41b85dd8ca450867180cc56fb348cb5ead2 Pg.pm
 SHA1 ff0fb11360e79db3c86e8b312cf58f62c5f19d2d Pg.xs
-SHA1 9f717dbf77dd46ee7c14082033b85be28f8e482c README
+SHA1 8f4abad643aa77b17a4452d6ed4ff2b4b553c4e2 README
 SHA1 8f20ecd6822bce2a39504beb087bdd341ace06f4 README.dev
 SHA1 968d5fad61bce160b31a9cb1a21dd240b9df930f README.win32
 SHA1 fe7a42afdeec6a218c45f76e875cc3324b870956 TODO
-SHA1 f6b95946b439ca1357b2deb7521fb9d2e90eff1b dbdimp.c
+SHA1 e7af4e19b3c02046a5e545bc169d5e6b7cf4b39b dbdimp.c
 SHA1 cf577f22e9dc3c591daa32c51ebd83dd38f55a8f dbdimp.h
 SHA1 6c33bcf138e577722283bef02fceb8cbce4d100d dbivport.h
-SHA1 c5180ae68ff0c3a76f6be482c1c1d70cba33bb79 lib/Bundle/DBD/Pg.pm
+SHA1 34423f202eba056955cc93616378163ee3a93819 lib/Bundle/DBD/Pg.pm
 SHA1 dbe8b0bd24538a61d4c617848e7fca27fd4ea3eb quote.c
 SHA1 0a1fdd0406c5c367a9aba366d1d35cfa8d5272ae quote.h
 SHA1 93aa7e8cae0a361d1e6163dea0281ebff41f3c5f t/00-signature.t
@@ -45,7 +45,7 @@
 SHA1 99aac4b46da5b138c42358854f8f9682b742c44d t/07copy.t
 SHA1 1413c886eaf1714db1cf8abfb989dabfd86dee87 t/08async.t
 SHA1 5027751944bdca8f0fe63c20c790c4c3beccf433 t/09arrays.t
-SHA1 a003cee9e26ab0ffd603b48acb7cd25d63ecdde6 t/12placeholders.t
+SHA1 46e3c5a05ba8a527cdd72fc4c9a392812ded4208 t/12placeholders.t
 SHA1 85b5df8ef0c78b1d2d0018d874c62af7ef01a28f t/20savepoints.t
 SHA1 711a85cb938c6aa8a2b4200c0836a7caa397bf9f t/99_perlcritic.t
 SHA1 3b22d5db94ca05d1fa1a8ea25d9c2ce866c36642 t/99_pod.t
@@ -65,7 +65,7 @@
 SHA1 f07cd5ecaeb854c81ceb9206364979cf607e6546 win32.mak
 -----BEGIN PGP SIGNATURE-----
 
-iEYEAREDAAYFAkkzG/oACgkQvJuQZxSWSsjx/ACgwZRl32bv5l21bR85EtI3kH+n
-uqMAnjxdY1rHUXFvJn1K/Pf8MdVT/YM4
-=ap01
+iEYEAREDAAYFAklD6l4ACgkQvJuQZxSWSshDWwCfQXYcz7FCXjWRn+bnyQSz5IXr
+0XkAoIu2cKhYZr6dlHhEvW4GiZBm/Gof
+=vClT
 -----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=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/dbdimp.c (original)
+++ trunk/libdbd-pg-perl/dbdimp.c Mon Dec 15 19:13:16 2008
@@ -1,6 +1,6 @@
 /*
 
-  $Id: dbdimp.c 12119 2008-11-30 22:06:55Z turnstep $
+  $Id: dbdimp.c 12153 2008-12-12 16:46:21Z turnstep $
 
   Copyright (c) 2002-2008 Greg Sabino Mullane and others: see the Changes file
   Portions Copyright (c) 2002 Jeffrey W. Baker
@@ -1500,6 +1500,8 @@
 
 	/* Builds the "segment" and "placeholder" structures for a statement handle */
 
+	D_imp_dbh_from_sth;
+
 	STRLEN currpos; /* Where we currently are in the statement string */
 
 	STRLEN sectionstart, sectionstop; /* Borders of current section */
@@ -1523,6 +1525,8 @@
 	bool inside_dollar; /* Inside a dollar quoted value */
 
 	char * dollarstring = NULL; /* Dynamic string between $$ in dollar quoting */
+
+	char standard_conforming_strings = 1; /* Status 0=on 1=unknown -1=off */
 
 	STRLEN xlen; /* Because "x" is too hard to search for */
 
@@ -1602,15 +1606,24 @@
 		if ('\'' == ch || '"' == ch) {
 			quote = ch;
 			backslashes = 0;
+			if ('\'' == ch && 1 == standard_conforming_strings) {
+				const char * scs = PQparameterStatus(imp_dbh->conn,"standard_conforming_strings");
+				standard_conforming_strings = (NULL==scs ? 1 : strncmp(scs,"on",2));
+			}
+
 			/* Go until ending quote character (unescaped) or end of string */
 			while (quote && ++currpos && (ch = *statement++)) {
 				/* 1.1 : single quotes have no meaning in double-quoted sections and vice-versa */
 				/* 1.2 : backslashed quotes do not end the section */
-				if (ch == quote && (0==(backslashes&1))) {
+				/* 1.2.1 : backslashes have no meaning in double quoted sections */
+				/* 1.2.2 : if standard_confirming_strings is set, ignore backslashes in single quotes */
+				if (ch == quote && (quote == '"' || 0==(backslashes&1))) {
 					quote = 0;
 				}
-				else if ('\\' == ch) 
-					backslashes++;
+				else if ('\\' == ch) {
+					if (quote == '"' || standard_conforming_strings)
+						backslashes++;
+				}
 				else
 					backslashes = 0;
 			}
@@ -1627,14 +1640,13 @@
 
 		/* 2: A comment block: */
 		if (('-' == ch && '-' == *statement) ||
-			('/' == ch && '/' == *statement) ||
 			('/' == ch && '*' == *statement)
 			) {
 			quote = *statement;
 			/* Go until end of comment (may be newline) or end of the string */
 			while (quote && ++currpos && (ch = *statement++)) {
-				/* 2.1: dashdash and slashslash only terminate at newline */
-				if (('-' == quote || '/' == quote) && '\n' == ch) {
+				/* 2.1: dashdash only terminates at newline */
+				if ('-' == quote && '\n' == ch) {
 					quote=0;
 				}
 				/* 2.2: slashstar ends with a matching starslash */
@@ -1655,8 +1667,16 @@
 		} /* end comment section */
 
 		/* 3: advanced dollar quoting - only if the backend is version 8 or higher */
-		if (version >= 80000 && '$' == ch && (*statement == '$' || *statement >= 'A')) {
-			/* Unlike PG, we allow a little more latitude in legal characters - anything >= 65 can be used */
+		if (version >= 80000 && '$' == ch && 
+			(*statement == '$' 
+			 || *statement == '_'
+			 || (*statement >= 'A' && *statement <= 'Z') 
+			 || (*statement >= 'a' && *statement <= 'z'))) {
+			/* "SQL identifiers must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) 
+                or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, 
+                digits (0-9), or dollar signs ($)
+			*/
+			/* Postgres technically allows \200-\377 as well, but we don't */
 			sectionsize = 0; /* How far from the first dollar sign are we? */
 			found = 0; /* Have we found the end of the dollarquote? */
 
@@ -1664,12 +1684,17 @@
 			while ((ch = *statement++)) {
 
 				sectionsize++;
-				/* If we hit an invalid character, bail out */
-				if (ch <= 32 || (ch >= '0' && ch <= '9')) {
+				if ('$' == ch) {
+					found = DBDPG_TRUE;
 					break;
 				}
-				if ('$' == ch) {
-					found = DBDPG_TRUE;
+
+				/* If we hit an invalid character, bail out */
+				if (ch <= 47 
+					|| (ch >= 58 && ch <= 64)
+					|| (ch >= 91 && ch <= 94)
+					|| ch == 96
+					|| (ch >= 123)) {
 					break;
 				}
 			} /* end first scan */

Modified: trunk/libdbd-pg-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/debian/changelog?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/debian/changelog (original)
+++ trunk/libdbd-pg-perl/debian/changelog Mon Dec 15 19:13:16 2008
@@ -1,3 +1,9 @@
+libdbd-pg-perl (2.11.7-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Mon, 15 Dec 2008 20:12:16 +0100
+
 libdbd-pg-perl (2.11.6-1) unstable; urgency=low
 
   * New upstream release.

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=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm (original)
+++ trunk/libdbd-pg-perl/lib/Bundle/DBD/Pg.pm Mon Dec 15 19:13:16 2008
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-$VERSION = '2.11.6';
+$VERSION = '2.11.7';
 
 1;
 

Modified: trunk/libdbd-pg-perl/t/12placeholders.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbd-pg-perl/t/12placeholders.t?rev=28268&op=diff
==============================================================================
--- trunk/libdbd-pg-perl/t/12placeholders.t (original)
+++ trunk/libdbd-pg-perl/t/12placeholders.t Mon Dec 15 19:13:16 2008
@@ -15,7 +15,7 @@
 if (! defined $dbh) {
 	plan skip_all => 'Connection to database failed, cannot continue testing';
 }
-plan tests => 28;
+plan tests => 45;
 
 my $t='Connect to database for placeholder testing';
 isnt ($dbh, undef, $t);
@@ -232,10 +232,76 @@
 };
 is ($@, q{}, $t);
 
+$t='Prepare works with placeholders after double slashes';
+eval {
+	$dbh->do(q{CREATE OPERATOR // ( PROCEDURE=bit, LEFTARG=int, RIGHTARG=int )});
+	$sth = $dbh->prepare(q{SELECT ? // ?});
+	$sth->execute(1,2);
+	$sth->finish();
+};
+is ($@, q{}, $t);
+
+$t='Dollar quotes starting with a number are not treated as valid identifiers';
+eval {
+	$sth = $dbh->prepare(q{SELECT $123$  $123$});
+	$sth->execute(1);
+	$sth->finish();
+};
+like ($@, qr{Invalid placeholders}, $t);
+
+$t='Dollar quotes with invalid characters are not parsed as identifiers';
+for my $char (qw!+ / : @ [ `!) {
+	eval {
+		$sth = $dbh->prepare(qq{SELECT \$abc${char}\$ 123 \$abc${char}\$});
+		$sth->execute();
+		$sth->finish();
+	};
+	like ($@, qr{syntax error}, $t);
+}
+
+$t='Dollar quotes with valid characters are parsed as identifiers';
+$dbh->rollback();
+for my $char (qw{0 9 A Z a z}) {
+	eval {
+		$sth = $dbh->prepare(qq{SELECT \$abc${char}\$ 123 \$abc${char}\$});
+		$sth->execute();
+		$sth->finish();
+	};
+	is ($@, q{}, $t);
+}
+
+$t='Backslash quoting inside double quotes is parsed correctly';
+eval {
+	$sth = $dbh->prepare(q{SELECT * FROM "\" WHERE a=?});
+	$sth->execute(1);
+	$sth->finish();
+};
+like ($@, qr{relation ".*" does not exist}, $t);
+$dbh->rollback();
+
+SKIP: {
+	skip 'Setting standard_conforming_strings not available', 2 if ! defined $scs;
+	$t='Backslash quoting inside single quotes is parsed correctly with standard_conforming_strings off';
+	eval {
+		$dbh->do(q{SET standard_conforming_strings = 'off'});
+		$sth = $dbh->prepare(q{SELECT '\', ?});
+		$sth->execute();
+		$sth->finish();
+	};
+	like ($@, qr{unterminated quoted string}, $t);
+	$dbh->rollback();
+
+	$t='Backslash quoting inside single quotes is parsed correctly with standard_conforming_strings on';
+	eval {
+		$dbh->do(q{SET standard_conforming_strings = 'on'});
+		$sth = $dbh->prepare(q{SELECT '\', ?::int});
+		$sth->execute(1);
+		$sth->finish();
+	};
+	is ($@, q{}, $t);
+}
+
 ## Begin custom type testing
-
-
-
 
 $dbh->rollback();
 




More information about the Pkg-perl-cvs-commits mailing list