Author: timbo
Date: Mon Jan  2 06:59:18 2012
New Revision: 15061

Modified:
   dbi/trunk/Changes
   dbi/trunk/Driver_xst.h
   dbi/trunk/dbixs_rev.h

Log:
Clear ParamValues on bind_param param count error RT66127

Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Mon Jan  2 06:59:18 2012
@@ -19,6 +19,7 @@
   Enhanced and standardized driver trace level mechanism (Tim Bunce)
   Removed old code that was an inneffective attempt to detect
     people doing DBI->{Attrib}.
+  Clear ParamValues on bind_param param count error RT66127 (Tim Bunce)
 
   Added pod for default_user to DBI::DBD (Martin J. Evans)
   Added CON, ENC and DBD trace flags and extended 09trace.t (Martin J. Evans)

Modified: dbi/trunk/Driver_xst.h
==============================================================================
--- dbi/trunk/Driver_xst.h      (original)
+++ dbi/trunk/Driver_xst.h      Mon Jan  2 06:59:18 2012
@@ -61,10 +61,15 @@
        && DBIc_NUM_PARAMS(imp_sth) != DBIc_NUM_PARAMS_AT_EXECUTE
     ) {
        char errmsg[99];
+        /* clear any previous ParamValues before error is generated */
+        SV **svp = hv_fetch((HV*)DBIc_MY_H(imp_sth),"ParamValues",11,FALSE));
+        if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) {
+            HV *hv = (HV*)SvRV(*svp);
+            hv_clear(*svp);
+        }
        sprintf(errmsg,"called with %d bind variables when %d are needed",
                (int)items-1, DBIc_NUM_PARAMS(imp_sth));
-       sv_setpv(DBIc_ERRSTR(imp_sth), errmsg);
-       sv_setiv(DBIc_ERR(imp_sth), (IV)-1);
+        DBIh_SET_ERR_CHAR(sth, imp_sth, "-1", -1, errmsg, Nullch, Nullch);
        return 0;
     }
     idx = sv_2mortal(newSViv(0));
@@ -90,8 +95,7 @@
     if (SvOK(slice)) {  /* should never get here */
        char errmsg[99];
        sprintf(errmsg,"slice param not supported by XS version of 
fetchall_arrayref");
-       sv_setpv(DBIc_ERRSTR(imp_sth), errmsg);
-       sv_setiv(DBIc_ERR(imp_sth), (IV)-1);
+        DBIh_SET_ERR_CHAR(sth, imp_sth, "-1", -1, errmsg, Nullch, Nullch);
        return &PL_sv_undef;
     }
     else {

Modified: dbi/trunk/dbixs_rev.h
==============================================================================
--- dbi/trunk/dbixs_rev.h       (original)
+++ dbi/trunk/dbixs_rev.h       Mon Jan  2 06:59:18 2012
@@ -1,3 +1,4 @@
-/* Tue Feb 22 17:17:57 2011 */
+/* Mon Jan  2 14:56:41 2012 */
+/* Mixed revision working copy (15055M:15060) */
 /* Code modified since last checkin */
-#define DBIXS_REVISION 14701
+#define DBIXS_REVISION 15055

Reply via email to