Add a patch (already included in the upstream CVS) to fix quote() with

bytea type.
This commit is contained in:
Jun Kuriyama 2005-08-28 07:11:46 +00:00
parent 0fe32b3273
commit b8c468cc17
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=141013
3 changed files with 46 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= DBD-Pg
PORTVERSION= 1.43
PORTREVISION= 1
CATEGORIES= databases perl5
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR= DBD

View File

@ -0,0 +1,34 @@
--- t/06bytea.t.orig Sun Mar 20 10:47:38 2005
+++ t/06bytea.t Thu Aug 4 22:34:26 2005
@@ -9,7 +9,7 @@
$|=1;
if (defined $ENV{DBI_DSN}) {
- plan tests => 3;
+ plan tests => 6;
} else {
plan skip_all => 'Cannot run test unless DBI_DSN is defined. See the README file';
}
@@ -22,12 +22,21 @@
$sth = $dbh->prepare(qq{INSERT INTO dbd_pg_test (id,bytetest) VALUES (?,?)});
$sth->bind_param(2, undef, { pg_type => DBD::Pg::PG_BYTEA });
-$sth->execute(400, "a\0b");
+ok($sth->execute(400, "a\0b", 'execute 401');
+ok($sth->execute(401, '\''), 'execute 401');
+ok($sth->execute(402, '\''), 'execute 402');
+
+
$sth = $dbh->prepare(qq{SELECT bytetest FROM dbd_pg_test WHERE id=?});
$sth->execute(400);
my $byte = $sth->fetchall_arrayref()->[0][0];
ok($byte eq "a\0b", "text from BYTEA column looks corect");
+
+$sth->execute(402);
+$byte = $sth->fetchall_arrayref()->[0][0];
+is($byte, '\'', 'text from BYTEA column with quote');
+
$sth->finish();
$dbh->rollback();

View File

@ -0,0 +1,11 @@
--- quote.c.orig Wed May 25 04:14:24 2005
+++ quote.c Thu Aug 4 22:34:26 2005
@@ -307,7 +307,7 @@
dest = result;
Copy("'", dest++, 1, char);
- strncpy(dest,intermead,strlen(intermead));
+ strncpy(dest,intermead,strlen(intermead)+1);
strcat(dest,"\'");
#if PGLIBVERSION >= 70400