Subject: | $sth->execute(undef) gives warning |
I notice someone has reported this before in #7387 but here is a patch
--- dbdimp.c.orig 2004-10-12 10:58:39.570009280 -0500
+++ dbdimp.c 2004-10-12 11:02:04.349878008 -0500
@@ -8,6 +8,8 @@
#define SvPV_nolen(x) SvPV(x,PL_na)
#endif
+#define SvPV_nolen_undef_ok(x) (SvOK(x) ? SvPV_nolen(x) : "undef")
+
#ifndef call_method
#define call_method(x,y) perl_call_method(x,y)
#endif
@@ -328,7 +330,7 @@
int sql_type = SvIV(sql_type_sv);
sqlite_trace(4, "params left in 0x%p: %d", imp_sth->params, 1+av_len(imp_sth->params));
- sqlite_trace(4, "bind %d type %d as %s", i, sql_type, SvPV_nolen(value));
+ sqlite_trace(4, "bind %d type %d as %s", i, sql_type, SvPV_nolen_undef_ok(value));
if (!SvOK(value)) {
sqlite_trace(5, "binding null");
@@ -430,7 +432,7 @@
}
pos = 2 * (SvIV(param) - 1);
sqlite_trace(3, "bind into 0x%p: %d => %s (%d) pos %d\n",
- imp_sth->params, SvIV(param), SvPV_nolen(value), sql_type, pos);
+ imp_sth->params, SvIV(param), SvPV_nolen_undef_ok(value), sql_type, pos);
av_store(imp_sth->params, pos, SvREFCNT_inc(value));
av_store(imp_sth->params, pos+1, newSViv(sql_type));