Subject: | mysql_bind_type_guessing fails on single "special" character |
Date: | Sun, 27 Jul 2014 13:10:30 +0200 |
To: | bug-DBD-mysql [...] rt.cpan.org |
From: | Oliver Welter <mail [...] oliwel.de> |
Hi,
this is a followup on #48242
(https://rt.cpan.org/Public/Bug/Display.html?id=48242).
mysql_bind_type_guessing detects a value which consists of only a single
character (plus,minus,dot,e) as a number, resulting in an invalid mysql
statement.
Reproduce:
my $sth = $dbh->prepare('insert into test (test) values (?)');
$sth->execute(('+'));
$sth->execute(('.'));
$sth->execute(('-'));
$sth->execute(('e'));
Causes "syntax error near ')'" resp. " Unknown column 'e' in 'field list".
Reason: Parts of the patch to solve 48242 have been reverted later, see
github commits:
6e296abd - introduces "seen_digit"
1474dcb0 - removes the flag by commenting it
+ /* Not sure why this was changed */
+ /* seen_digit= 1; */
+ /* Need to revisit this */
+ /*if (len == 0 || cp - string < (int) len || seen_digit == 0) {*/
+ if (len == 0 || cp - string < (int) len) {
I did not have a full view on the code, but reactivating these lines
SHOULD fix the issue without any side effects.
Oliver
--
Protect your environment - close windows and adopt a penguin!
Message body not shown because it is not plain text.