in reply to DBI-trace and $hDB-quote() interaction
Could you make a similar case script? The culprit could be something else.#!/usr/bin/perl -w use DBI; use strict; my $hDB = DBI->connect("DBI:mysql:test;host=localhost" . ";mysql_read_default_file=$ENV{HOME}/.my.cnf", undef, undef, {RaiseError => 1}) or die "can't connect\n"; my $Vars = { 'userid' => 'joe', 'password' => 'secret'}; DBI->trace ( 0 ); my $UserID = $hDB->quote ( $Vars->{ userid } ); my $Password = $hDB->quote ( $Vars->{ password } ); DBI->trace ( 0 ); print "$UserID $Password\n"; $hDB->disconnect(); __END__ 'joe' 'secret'
update (2)my ($UserID, $Password) = map {$hDB->quote( "$_" )} ($Vars->{userid}, $Vars->{password});
It solves the problem, but doesn't satisfy my curiosity ... ;)my $UserID = $hDB->quote ( "$Vars->{'userid'}" ); my $Password = $hDB->quote ( "$Vars->{'password'}" );
This code will return NULL if the string passed is undefined. However, the string is defined, as I could check with a simple print.# from the DBI.pm module 1126 sub quote { 1127 my ($dbh, $str, $data_type) = @_; 1128 1129 return "NULL" unless defined $str; # more code follows .....
_ _ _ _ (_|| | |(_|>< _|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (2) DBI-trace and $hDB-quote() interaction
by talexb (Chancellor) on May 23, 2002 at 13:21 UTC | |
|
Re: (2) DBI-trace and $hDB-quote() interaction
by talexb (Chancellor) on May 23, 2002 at 14:03 UTC |