Author: turnstep
Date: Sat Apr 12 18:19:31 2008
New Revision: 11071

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

Log:
Add all_bound to prevent looping through our placeholder list more than once 
per execute.


Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes        (original)
+++ DBD-Pg/trunk/Changes        Sat Apr 12 18:19:31 2008
@@ -3,6 +3,7 @@
 2.5.2 Released April, 2008
 
        - Fix minor build issue with Strawberry Perl [GSM]
+       - Various performance improvements [GSM]
 
 2.5.1 Released April 7, 2008 (subversion r11056)
 

Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c       (original)
+++ DBD-Pg/trunk/dbdimp.c       Sat Apr 12 18:19:31 2008
@@ -1363,6 +1363,7 @@
        imp_sth->has_default      = DBDPG_FALSE; /* Are any of the params 
DEFAULT? */
        imp_sth->has_current      = DBDPG_FALSE; /* Are any of the params 
DEFAULT? */
        imp_sth->use_inout        = DBDPG_FALSE; /* Are any of the placeholders 
using inout? */
+       imp_sth->all_bound        = DBDPG_FALSE; /* Have all placeholders been 
bound? */
 
 
        /* We inherit some preferences from the database handle */
@@ -2741,7 +2742,7 @@
                croak("Must call pg_endcopy before issuing more commands");
 
        /* Ensure that all the placeholders have been bound */
-       if (imp_sth->numphs!=0) {
+       if (!imp_sth->all_bound && imp_sth->numphs!=0) {
                for (currph=imp_sth->ph; NULL != currph; currph=currph->nextph) 
{
                        if (NULL == currph->bind_type) {
                                pg_error(aTHX_ sth, PGRES_FATAL_ERROR, "execute 
called with an unbound placeholder");
@@ -2755,6 +2756,7 @@
                                currph->value[currph->valuelen] = '\0';
                        }
                }
+               imp_sth->all_bound = DBDPG_TRUE;
        }
 
        /* Check for old async transactions */

Modified: DBD-Pg/trunk/dbdimp.h
==============================================================================
--- DBD-Pg/trunk/dbdimp.h       (original)
+++ DBD-Pg/trunk/dbdimp.h       Sat Apr 12 18:19:31 2008
@@ -103,6 +103,7 @@
        bool   has_current;      /* does it have one or more 'DEFAULT' values? 
*/
        bool   dollaronly;       /* Only use $1 as placeholders, allow all else 
*/
        bool   use_inout;        /* Any placeholders using inout? */
+       bool   all_bound;        /* Have all placeholders been bound? */
 };
 
 

Reply via email to