=== dbdimp.c
==================================================================
--- dbdimp.c (revision 25104)
+++ dbdimp.c (local)
@@ -4591,10 +4591,14 @@
{
int seen_neg;
int seen_dec;
+ int seen_e;
+ int seen_plus;
char *cp;
- seen_neg= 0;
- seen_dec= 0;
+ seen_neg = 0;
+ seen_dec = 0;
+ seen_e = 0;
+ seen_plus= 0;
if (len <= 0) {
len= strlen(string);
@@ -4610,17 +4614,12 @@
{
if ('-' == *cp)
{
- if (seen_neg)
+ if (seen_neg >= 2)
{
- /* second '-' */
+ /* third '-'. number can contains two '-'. because -1e-10 is valid number */
break;
}
- else if (cp > string)
- {
- /* '-' after digit(s) */
- break;
- }
- seen_neg= 1;
+ seen_neg += 1;
}
else if ('.' == *cp)
{
@@ -4631,6 +4630,24 @@
}
seen_dec= 1;
}
+ else if ('e' == *cp)
+ {
+ if (seen_e)
+ {
+ /* second 'e' */
+ break;
+ }
+ seen_e= 1;
+ }
+ else if ('+' == *cp)
+ {
+ if (seen_plus)
+ {
+ /* second '+' */
+ break;
+ }
+ seen_plus= 1;
+ }
else if (!isdigit(*cp))
{
break;
=== t/90bind_bugs.t
==================================================================
--- t/90bind_bugs.t (revision 25104)
+++ t/90bind_bugs.t (local)
@@ -0,0 +1,35 @@
+#!perl -w
+# vim: ft=perl
+
+use Test::More;
+use DBI;
+use strict;
+use lib 't', '.';
+require 'lib.pl';
+$|= 1;
+
+use vars qw($table $test_dsn $test_user $test_password);
+my $dbh;
+eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
+ { RaiseError => 1, PrintError => 1, AutoCommit => 0 });};
+
+if ($@) {
+ plan skip_all => "ERROR: $DBI::errstr. Can't continue test";
+}
+plan tests => 3;
+
+sub do_test {
+ my $number = shift;
+ my $sth = $dbh->prepare('select ?') or die $dbh->errstr;
+ $sth->bind_param(1, $number, DBI::SQL_FLOAT) or die $dbh->errstr;
+ $sth->execute() or die $dbh->errstr;
+
+ is $sth->fetchrow_arrayref()->[0], $number;
+
+ $dbh->rollback();
+}
+
+do_test(10**19);
+do_test(10**-19);
+do_test(-10**-19);
+