From 47b4fe2e1016a8e3c836554102d647a493cb7fc0 Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Fri, 18 Mar 2005 13:21:41 +0000 Subject: [PATCH] Fix critical compatibility issue which breaks INSERTs in the new version of the module it is used with servers that implement 3.0 version of the postgres protocol, particularly 7.4.7 is affected. Bump PORTREVISION. Obtained from: DBD::Pg CVS References: https://rt.cpan.org/NoAuth/Bug.html?id=11744 http://gborg.postgresql.org/project/dbdpg/cvs/diff.php/dbdpg/dbdimp.c?r1=1.101&r2=1.102&ty=h&Horde=12014eaeef6c96c2fead3bcfa53ac92e --- databases/p5-DBD-Pg-13/Makefile | 1 + databases/p5-DBD-Pg-13/files/patch-11744 | 66 ++++++++++++++++++++++++ databases/p5-DBD-Pg/Makefile | 1 + databases/p5-DBD-Pg/files/patch-11744 | 66 ++++++++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 databases/p5-DBD-Pg-13/files/patch-11744 create mode 100644 databases/p5-DBD-Pg/files/patch-11744 diff --git a/databases/p5-DBD-Pg-13/Makefile b/databases/p5-DBD-Pg-13/Makefile index ccbeeec0a793..4ce03272ceba 100644 --- a/databases/p5-DBD-Pg-13/Makefile +++ b/databases/p5-DBD-Pg-13/Makefile @@ -7,6 +7,7 @@ PORTNAME= DBD-Pg PORTVERSION= 1.40 +PORTREVISION= 1 CATEGORIES= databases perl5 MASTER_SITES= ${MASTER_SITE_PERL_CPAN} MASTER_SITE_SUBDIR= DBD diff --git a/databases/p5-DBD-Pg-13/files/patch-11744 b/databases/p5-DBD-Pg-13/files/patch-11744 new file mode 100644 index 000000000000..c65e532a1a9b --- /dev/null +++ b/databases/p5-DBD-Pg-13/files/patch-11744 @@ -0,0 +1,66 @@ +=================================================================== +RCS file: /usr/local/cvsroot/dbdpg/dbdpg/dbdimp.c,v +retrieving revision 1.101 +retrieving revision 1.102 +diff -p --unified=3 -r1.101 -r1.102 +--- dbdimp.c 2005/03/11 15:37:31 1.101 ++++ dbdimp.c 2005/03/15 01:51:13 1.102 +@@ -1034,6 +1019,7 @@ void dbd_st_split_statement (sth, imp_st + newph->value = NULL; + newph->quoted = NULL; + newph->referenced = 0; ++ newph->defaultval = 1; + New(0, newph->fooname, newsize+1, char); /* freed in dbd_st_destroy */ + if (!newph->fooname) + croak("No memory"); +@@ -1124,6 +1110,7 @@ void dbd_st_split_statement (sth, imp_st + newph->value = NULL; + newph->quoted = NULL; + newph->referenced = 0; ++ newph->defaultval = 1; + newph->fooname = NULL; + /* Let the correct segment point to it */ + while (!currseg->placeholder) +@@ -1269,7 +1256,7 @@ int dbd_st_prepare_statement (sth, imp_s + params = imp_sth->numphs; + paramTypes = calloc(imp_sth->numphs, sizeof(*paramTypes)); + for (x=0,currph=imp_sth->ph; NULL != currph; currph=currph->nextph) { +- paramTypes[x++] = currph->bind_type->type_id; ++ paramTypes[x++] = currph->defaultval ? 0 : currph->bind_type->type_id; + } + } + result = PQprepare(imp_dbh->conn, imp_sth->prepare_name, statement, params, paramTypes); +@@ -1424,12 +1410,14 @@ int dbd_bind_ph (sth, imp_sth, ph_name, + } + } + else if (NULL == currph->bind_type) { /* "sticky" data type */ ++ /* This is the default type, but we will honor defaultval if we can */ + currph->bind_type = pg_type_data(VARCHAROID); + if (!currph->bind_type) + croak("Default type is bad!!!!???"); + } + + if (pg_type || sql_type) { ++ currph->defaultval = 0; + /* Possible re-prepare, depending on whether the type name also changes */ + if (imp_sth->prepared_by_us && NULL != imp_sth->prepare_name) + reprepare=1; +@@ -1685,7 +1673,7 @@ int dbd_st_execute (sth, imp_sth) /* <= + /* Populate paramTypes */ + paramTypes = calloc(imp_sth->numphs, sizeof(*paramTypes)); + for (x=0,currph=imp_sth->ph; NULL != currph; currph=currph->nextph) { +- paramTypes[x++] = currph->bind_type->type_id; ++ paramTypes[x++] = currph->defaultval ? 0 : currph->bind_type->type_id; + } + + if (dbis->debug >= 10) { +--- dbdimp.h 2005/03/18 13:10:05 1.1 ++++ dbdimp.h 2005/03/18 13:10:32 +@@ -59,6 +59,7 @@ + char *quoted; /* quoted version of the value, for PQexec only */ + STRLEN quotedlen; /* length of the quoted value */ + bool referenced; /* used for PREPARE AS construction */ ++ bool defaultval; /* is it using a generic 'default' value? */ + sql_type_info_t* bind_type; /* type information for this placeholder */ + struct ph_st *nextph; /* more linked list goodness */ + }; diff --git a/databases/p5-DBD-Pg/Makefile b/databases/p5-DBD-Pg/Makefile index ccbeeec0a793..4ce03272ceba 100644 --- a/databases/p5-DBD-Pg/Makefile +++ b/databases/p5-DBD-Pg/Makefile @@ -7,6 +7,7 @@ PORTNAME= DBD-Pg PORTVERSION= 1.40 +PORTREVISION= 1 CATEGORIES= databases perl5 MASTER_SITES= ${MASTER_SITE_PERL_CPAN} MASTER_SITE_SUBDIR= DBD diff --git a/databases/p5-DBD-Pg/files/patch-11744 b/databases/p5-DBD-Pg/files/patch-11744 new file mode 100644 index 000000000000..c65e532a1a9b --- /dev/null +++ b/databases/p5-DBD-Pg/files/patch-11744 @@ -0,0 +1,66 @@ +=================================================================== +RCS file: /usr/local/cvsroot/dbdpg/dbdpg/dbdimp.c,v +retrieving revision 1.101 +retrieving revision 1.102 +diff -p --unified=3 -r1.101 -r1.102 +--- dbdimp.c 2005/03/11 15:37:31 1.101 ++++ dbdimp.c 2005/03/15 01:51:13 1.102 +@@ -1034,6 +1019,7 @@ void dbd_st_split_statement (sth, imp_st + newph->value = NULL; + newph->quoted = NULL; + newph->referenced = 0; ++ newph->defaultval = 1; + New(0, newph->fooname, newsize+1, char); /* freed in dbd_st_destroy */ + if (!newph->fooname) + croak("No memory"); +@@ -1124,6 +1110,7 @@ void dbd_st_split_statement (sth, imp_st + newph->value = NULL; + newph->quoted = NULL; + newph->referenced = 0; ++ newph->defaultval = 1; + newph->fooname = NULL; + /* Let the correct segment point to it */ + while (!currseg->placeholder) +@@ -1269,7 +1256,7 @@ int dbd_st_prepare_statement (sth, imp_s + params = imp_sth->numphs; + paramTypes = calloc(imp_sth->numphs, sizeof(*paramTypes)); + for (x=0,currph=imp_sth->ph; NULL != currph; currph=currph->nextph) { +- paramTypes[x++] = currph->bind_type->type_id; ++ paramTypes[x++] = currph->defaultval ? 0 : currph->bind_type->type_id; + } + } + result = PQprepare(imp_dbh->conn, imp_sth->prepare_name, statement, params, paramTypes); +@@ -1424,12 +1410,14 @@ int dbd_bind_ph (sth, imp_sth, ph_name, + } + } + else if (NULL == currph->bind_type) { /* "sticky" data type */ ++ /* This is the default type, but we will honor defaultval if we can */ + currph->bind_type = pg_type_data(VARCHAROID); + if (!currph->bind_type) + croak("Default type is bad!!!!???"); + } + + if (pg_type || sql_type) { ++ currph->defaultval = 0; + /* Possible re-prepare, depending on whether the type name also changes */ + if (imp_sth->prepared_by_us && NULL != imp_sth->prepare_name) + reprepare=1; +@@ -1685,7 +1673,7 @@ int dbd_st_execute (sth, imp_sth) /* <= + /* Populate paramTypes */ + paramTypes = calloc(imp_sth->numphs, sizeof(*paramTypes)); + for (x=0,currph=imp_sth->ph; NULL != currph; currph=currph->nextph) { +- paramTypes[x++] = currph->bind_type->type_id; ++ paramTypes[x++] = currph->defaultval ? 0 : currph->bind_type->type_id; + } + + if (dbis->debug >= 10) { +--- dbdimp.h 2005/03/18 13:10:05 1.1 ++++ dbdimp.h 2005/03/18 13:10:32 +@@ -59,6 +59,7 @@ + char *quoted; /* quoted version of the value, for PQexec only */ + STRLEN quotedlen; /* length of the quoted value */ + bool referenced; /* used for PREPARE AS construction */ ++ bool defaultval; /* is it using a generic 'default' value? */ + sql_type_info_t* bind_type; /* type information for this placeholder */ + struct ph_st *nextph; /* more linked list goodness */ + };