in reply to check bind_columns for undefined values
Why would you want to replace undef values (which correspond to NULL-values in the database) with the string "null" anyway? That can change the datatype of the column (since numeric columns can also contain NULL values, which you change to a text datatype).
To answer your question, if you use
You'd have to check all vars to see if they're undef after fetching data and act accordingly.$sth->bind_columns(\$var1, \$var2, \$var3);
This method might make things simpler:
Now you can use@list_of_refs_to_vars_to_bind = (\$var1, \$var2, \$var3); $sth->bind_columns(@list_of_refs_to_vars_to_bind);
to do your evil thing.map { $$_ = "null" if (!defined $$_); } @list_of_refs_to_vars_to_bind;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: check bind_columns for undefined values
by Anonymous Monk on Feb 12, 2013 at 00:35 UTC | |
by ww (Archbishop) on Feb 12, 2013 at 02:51 UTC |
In Section
Seekers of Perl Wisdom