Subject: | 64bit BIGINT support [patch] |
Hello,
all SQL_INTEGER/IISQ_INT_TYPE fields are handled using "int", which for BIGINT on
64bits machines leads to:
=====
E_LQ000B Overflow of numeric data from column X into program variable
=====
while fetching data.
In the attached patch, I've removed all explicit casts and used Perl's IV instead.
While everything works fine on my server, I could not test on a 32bits one though...
Hope this helps
Subject: | DBD-Ingres_64bits.patch |
diff -Nur DBD-Ingres-0.53.orig/dbdimp.sc DBD-Ingres-0.53/dbdimp.sc
--- DBD-Ingres-0.53.orig/dbdimp.sc 2009-09-30 11:24:32.000000000 +0200
+++ DBD-Ingres-0.53/dbdimp.sc 2012-01-21 13:17:47.470069405 +0100
@@ -40,8 +40,8 @@
i, var->sqltype, var->sqllen, var->sqlind);
switch (var->sqltype) {
case IISQ_INT_TYPE:
- PerlIO_printf(DBILOGFP, ", var: %d\n",
- *((int*)(var->sqldata)));
+ PerlIO_printf(DBILOGFP, ", var: %ld\n",
+ *((IV*)(var->sqldata)));
break;
case IISQ_FLT_TYPE:
PerlIO_printf(DBILOGFP, ", var: %g\n",
@@ -974,7 +974,7 @@
switch (var->sqltype) {
case IISQ_INT_TYPE:
var->sqltype = IISQ_INT_TYPE;
- fbh->len = var->sqllen = sizeof(int);
+ fbh->len = var->sqllen = sizeof(IV);
strcpy(fbh->type, "d");
fbh->sv = newSV((STRLEN)fbh->len);
SvOK_off(fbh->sv);
@@ -1191,10 +1191,10 @@
/* addition: now you have to :( */
case 1: /* int */
var->sqltype = IISQ_INT_TYPE;
- var->sqllen = sizeof(int);
+ var->sqllen = sizeof(IV);
Renew(var->sqldata, var->sqllen, char);
if (SvOK(value))
- *(int *)var->sqldata = (int)SvIV(value);
+ *(IV *)var->sqldata = SvIV(value);
break;
case 2: /* float */
var->sqltype = IISQ_FLT_TYPE;
@@ -1412,10 +1412,10 @@
} else {
switch (fbh->type[0]) {
case 'd':
- sv_setiv(sv, (IV)*(int*)var->sqldata);
+ sv_setiv(sv, *(IV*)var->sqldata);
if (dbis->debug >= 3)
- PerlIO_printf(DBILOGFP, "Int: %ld %d\n",
- SvIV(sv), *(int*)var->sqldata);
+ PerlIO_printf(DBILOGFP, "Int: %ld %ld\n",
+ SvIV(sv), *(IV*)var->sqldata);
break;
case 'f':
sv_setnv(sv, *(double*)var->sqldata);
@@ -1691,9 +1691,12 @@
len = 5; /* 0 .. 65000 */
break;
case 4:
- default:
len = 10; /* 0 .. 2_140_000_000 */
break;
+ case 8:
+ default:
+ len = 20; /* 0 .. biiiggg */
+ break;
}
break;
case IISQ_MNY_TYPE: