RSevrinsky has asked for the wisdom of the Perl Monks concerning the following question:
Specifically, I'm trying to use DBI to automatically quote an element of a hash tied via CGI->Vars:
use DBI; use CGI; $q = new CGI("test=foo"); $p = $q->Vars; $dbh = DBI->connect("dbi:mysql:test"); print "element is $p->{test}, quoted element is " . $dbh->quote($p->{test}) . "\n"; $test = $p->{test}; print "element is $test, quoted element is " . $dbh->quote($test) . "\n";
For some reason, it seems that DBI thinks that its parameter is not defined() and returns NULL. I've tried this with NDBM_File as well and experienced the same behavior.
Strangely enough, if you try tracing the DBI handle at level 2 or higher, it works just fine:
DBI->trace(2, 'dbitrace.log');
Is there something I can do to use the tied hash elements without constant copying them out, and without slowing down for full tracing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI-quote doesn't like tied hashes?
by chromatic (Archbishop) on May 17, 2000 at 01:00 UTC | |
by btrott (Parson) on May 17, 2000 at 01:03 UTC | |
by BBQ (Curate) on May 17, 2000 at 01:30 UTC | |
|
Re: DBI-quote doesn't like tied hashes?
by btrott (Parson) on May 17, 2000 at 07:09 UTC |