moggs has asked for the wisdom of the Perl Monks concerning the following question:
Greetings esteemed Monks and Monkettes*
I strictly use $dbh->quote() to quote data before inserting or selecting it with MySQL using DBI. No problems, this is great (fantastic, actually).
When a value is undef, $dbh->quote() return NULL, but is there anyway to override this behaviour? I'd like it to return an empty string.
I could, of course, tweak DBI.pm but I'd like a more portable solution.
A second option... is there any way to write a subroutine I could call using $dbh->quotestr() - my own routine which doesn't interfere with the DBI's inner workings?
Many thanks indeed... happy new year to everyone (again).
* Monkette... girl Monk - we know there's many here and most knowledgable :o)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inserting an empty string, not NULL, with $dbh->quote()
by afoken (Chancellor) on Jan 05, 2012 at 15:27 UTC | |
by afoken (Chancellor) on Jan 05, 2012 at 15:38 UTC | |
by morgon (Priest) on Jan 05, 2012 at 23:53 UTC | |
|
Re: Inserting an empty string, not NULL, with $dbh->quote()
by ikegami (Patriarch) on Jan 05, 2012 at 19:03 UTC | |
|
Re: Inserting an empty string, not NULL, with $dbh->quote()
by roboticus (Chancellor) on Jan 05, 2012 at 15:28 UTC | |
|
Re: Inserting an empty string, not NULL, with $dbh->quote() (monkeypatching)
by tye (Sage) on Jan 05, 2012 at 22:58 UTC |