The DBI provides a neatsvpv(sv, maxlen) function specifically for
use in trace messages etc (it's the same as DBI::neat).

It handles undefs and much else besides. I'd recommend it.

Tim.

p.s. I'd also recommend turning of wrapping in your mail tool,
or setting the wrap marging higher.

On Mon, Jan 17, 2005 at 09:50:17AM +1300, Sam Vilain wrote:
> These debug messages cause "Use of uninitialised variable..." warnings
> when you pass in undef parameters to $sth->execute();
> 
> Also logged as https://rt.cpan.org/Ticket/Display.html?id=9121
> 
> --- dbdimp.c~   2004-10-05 09:02:21.000000000 +1300
> +++ dbdimp.c    2004-12-24 14:45:13.000000000 +1300
> @@ -328,7 +328,7 @@
>          int sql_type = SvIV(sql_type_sv);
> 
>          sqlite_trace(4, "params left in 0x%p: %d", imp_sth->params, 
> 1+av_len(im
> p_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, 
> (SvPOK(value) ? S
> vPV_nolen(value) : "NULL"));
> 
>          if (!SvOK(value)) {
>              sqlite_trace(5, "binding null");
> @@ -431,7 +431,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), (SvPOK(value) ? SvPV_nolen(value) : 
> "NULL")
> , sql_type, pos);
>      av_store(imp_sth->params, pos, SvREFCNT_inc(value));
>      av_store(imp_sth->params, pos+1, newSViv(sql_type));
> 
> 
> -- 
> Sam Vilain, sam /\T vilain |><>T net, PGP key ID: 0x05B52F13
> (include my PGP key ID in personal replies to avoid spam filtering)

Reply via email to