DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

mysql_bind_type_guessing fails on single "special" character [rt.cpan.org #97541]

Open mbeijen opened this issue 8 years ago • 1 comments
trafficstars

Migrated from rt.cpan.org#97541 (status was 'new')

Requestors:

Attachments:

From [email protected] on 2014-07-27 11:10:54:

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!

mbeijen avatar Nov 14 '17 19:11 mbeijen

Fixed for DBD::MariaDB (https://github.com/gooddata/DBD-MariaDB) in pull request: https://github.com/gooddata/DBD-MariaDB/pull/57

pali avatar Jun 27 '18 12:06 pali