in reply to Re: DBD::mysql Unusual Behavior
in thread DBD::mysql Unusual Behavior
Also, priming the query with some stupid data did the trick too:my $foo = ''.$key_value; my $foo = "$key_value"; my $foo = eval($dbh->quote($key_value)); # Desperation
$sth->execute(1,"A","B","C");Now it just occured to me that the data in $key_value leading up to the call that failed was strictly numeric, except when either a) the code was literally converted to a scalar, or b) enquoted, to force stringification.
Note the numeric in the fourth column (CHAR). Why would this matter?my $sth = $dbh->prepare(" INSERT INTO web_sessions_aux (wsa_id, wsa_type, wsa_key, wsa_value) VALUES (?,?,?,?)", {}); my $rv = $sth->execute("2012","CRS","crs_search_index",1) && $sth->execute("2012","CRS","crs_search_criteria","S") ; $sth->finish();
You can see here that if the placeholder type is not set, it uses the Perl internal representation as a hint. Unfortunately, once assigned, this is never checked again. To clear up the problem, I just assigned straight to SQL_INTEGER and everything is A-OK.if (!ph->type) { ph->type = SvNIOK(ph->value) ? SQL_INTEGER : SQL_VARCHAR; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re^2: DBD::mysql Unusual Behavior
by bart (Canon) on Aug 23, 2002 at 20:44 UTC | |
by tadman (Prior) on Aug 23, 2002 at 21:19 UTC |