From b8c468cc17ba23e888ef3d4ab89f49c00a051672 Mon Sep 17 00:00:00 2001 From: Jun Kuriyama Date: Sun, 28 Aug 2005 07:11:46 +0000 Subject: [PATCH] Add a patch (already included in the upstream CVS) to fix quote() with bytea type. --- databases/p5-DBD-Pg/Makefile | 1 + databases/p5-DBD-Pg/files/patch-06bytea.t | 34 +++++++++++++++++++++++ databases/p5-DBD-Pg/files/patch-quote.c | 11 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 databases/p5-DBD-Pg/files/patch-06bytea.t create mode 100644 databases/p5-DBD-Pg/files/patch-quote.c diff --git a/databases/p5-DBD-Pg/Makefile b/databases/p5-DBD-Pg/Makefile index 3ea671327b7a..c6c60a635959 100644 --- a/databases/p5-DBD-Pg/Makefile +++ b/databases/p5-DBD-Pg/Makefile @@ -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 diff --git a/databases/p5-DBD-Pg/files/patch-06bytea.t b/databases/p5-DBD-Pg/files/patch-06bytea.t new file mode 100644 index 000000000000..3a02b028fa50 --- /dev/null +++ b/databases/p5-DBD-Pg/files/patch-06bytea.t @@ -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(); diff --git a/databases/p5-DBD-Pg/files/patch-quote.c b/databases/p5-DBD-Pg/files/patch-quote.c new file mode 100644 index 000000000000..0ffbf3bd2f33 --- /dev/null +++ b/databases/p5-DBD-Pg/files/patch-quote.c @@ -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