Author: turnstep
Date: Sat Nov 22 08:01:31 2008
New Revision: 12099

Modified:
   DBD-Pg/trunk/Changes
   DBD-Pg/trunk/dbdimp.c

Log:
Clear the prepared statement name on prepare fail, for a better error message 
when prepare_cached is used. Per discussion on the mailing list.


Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes        (original)
+++ DBD-Pg/trunk/Changes        Sat Nov 22 08:01:31 2008
@@ -1,5 +1,10 @@
 ('GSM' is Greg Sabino Mullane, [EMAIL PROTECTED])
 
+2.11.5
+
+       - Clear prepared_statement name on failure to prepare: prevents 
+               the wrong error when using prepare_cached. [GSM]
+
 2.11.4 Released November 12, 2008
 
        - Don't set LC_MESSAGES unless superuser in tests. Remove all 

Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c       (original)
+++ DBD-Pg/trunk/dbdimp.c       Sat Nov 22 08:01:31 2008
@@ -2100,6 +2100,8 @@
        Safefree(statement);
        if (PGRES_COMMAND_OK != status) {
                TRACE_PQERRORMESSAGE;
+               Safefree(imp_sth->prepare_name);
+               imp_sth->prepare_name = NULL;
                pg_error(aTHX_ sth, status, PQerrorMessage(imp_dbh->conn));
                if (TEND) TRC(DBILOGFP, "%sEnd pg_st_prepare_statement 
(error)\n", THEADER);
                return -2;

Reply via email to