Re: Problem with connection.
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
2010/1/21 James K. Lowden <[email protected]>: > Frediano Ziglio wrote: >> there is no direct >> support for bigint in dblib... you should use numeric. DBINT8/DBINT64 >> would be an extension to dblib. > > The vendors, each for their own reasons, haven't kept their db-libs up to > date. So I guess it's up to us. > >> It seems Sybase defined support for >> bigint only for ctlib (odbc already support 64bit integers) using >> CS_BIGINT. We could define an extension for this binding and type. > > That's what I think we should do. I'm just hoping "we" is a man with an > itch and a patch. > >> tds_willconvert and tds_convert already support SYBINT8 so the >> extension would affect only dblib library not libTDS code. > > Excellent. > Something like that (not tested) ? I also wrote a patch (quite small...) to package using bzip2 instead of gzip. Do you think is worst applying it? freddy77 _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds
01-dblib_bigint.diff
(application/octet-stream, 2.9 KB)
Index: freetds83/include/sybdb.h
===================================================================
--- freetds83.orig/include/sybdb.h 2010-01-21 09:29:36.041389748 +0100
+++ freetds83/include/sybdb.h 2010-01-21 09:35:09.873882145 +0100
@@ -227,6 +227,7 @@
typedef unsigned char DBTINYINT;
typedef tds_sysdep_int16_type DBSMALLINT;
typedef tds_sysdep_int32_type DBINT;
+typedef tds_sysdep_int64_type DBBIGINT;
typedef unsigned char DBBINARY;
typedef tds_sysdep_real32_type DBREAL;
typedef tds_sysdep_real64_type DBFLT8;
@@ -453,7 +454,8 @@
#define BITBIND 16
#define NUMERICBIND 17
#define DECIMALBIND 18
-#define MAXBINDTYPES 19 /* keep last */
+#define BIGINTBIND 30
+#define MAXBINDTYPES 30 /* keep last */
#define DBPRCOLSEP 21
#define DBPRLINELEN 22
Index: freetds83/src/dblib/dblib.c
===================================================================
--- freetds83.orig/src/dblib/dblib.c 2010-01-21 09:29:36.051382358 +0100
+++ freetds83/src/dblib/dblib.c 2010-01-21 09:35:09.873882145 +0100
@@ -441,6 +441,7 @@
static const DBTINYINT null_TINYINT = 0;
static const DBSMALLINT null_SMALLINT = 0;
static const DBINT null_INT = 0;
+static const DBBIGINT null_BIGINT = 0;
static const DBFLT8 null_FLT8 = 0;
static const DBREAL null_REAL = 0;
@@ -474,7 +475,19 @@
/* BITBIND 16 */ , { &null_BIT, sizeof(null_BIT) }
/* NUMERICBIND 17 */ , { (BYTE*) &null_NUMERIC, sizeof(null_NUMERIC) }
/* DECIMALBIND 18 */ , { (BYTE*) &null_NUMERIC, sizeof(null_NUMERIC) }
- /* MAXBINDTYPES 19 */
+ /* 19 */ , { NULL, 0 }
+ /* 20 */ , { NULL, 0 }
+ /* 21 */ , { NULL, 0 }
+ /* 22 */ , { NULL, 0 }
+ /* 23 */ , { NULL, 0 }
+ /* 24 */ , { NULL, 0 }
+ /* 25 */ , { NULL, 0 }
+ /* 26 */ , { NULL, 0 }
+ /* 27 */ , { NULL, 0 }
+ /* 28 */ , { NULL, 0 }
+ /* 29 */ , { NULL, 0 }
+ /* BIGINTBIND 30 */ , { (BYTE*) &null_BIGINT, sizeof(null_BIGINT) }
+ /* MAXBINDTYPES 30 */
};
static int
@@ -503,6 +516,7 @@
case SYBINT1: return TINYBIND;
case SYBINT2: return SMALLBIND;
case SYBINT4: return INTBIND;
+ case SYBINT8: return BIGINTBIND;
case SYBMONEY: return MONEYBIND;
case SYBMONEY4: return SMALLMONEYBIND;
@@ -562,6 +576,7 @@
case SMALLDATETIMEBIND:
case SMALLMONEYBIND:
case TINYBIND:
+ case BIGINTBIND:
memcpy(varaddr, pnullrep->bindval, pnullrep->len);
return SUCCEED;
default:
@@ -1874,6 +1889,7 @@
case SMALLDATETIMEBIND:
case SMALLMONEYBIND:
case TINYBIND:
+ case BIGINTBIND:
bindlen = (int)default_null_representations[bindtype].len;
break;
@@ -2078,6 +2094,9 @@
case TINYBIND:
return SYBINT1;
break;
+ case BIGINTBIND:
+ return SYBINT8;
+ break;
case DATETIMEBIND:
return SYBDATETIME;
break;
02-bzip2.diff
(application/octet-stream, 452 B)
Index: freetds83/configure.ac =================================================================== --- freetds83.orig/configure.ac 2010-01-21 09:29:35.981384986 +0100 +++ freetds83/configure.ac 2010-01-21 09:35:10.103911519 +0100 @@ -17,7 +17,7 @@ AC_PREREQ(2.53) AC_REVISION($Revision: 1.43 $) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) AC_CONFIG_HEADERS(include/config.h) dnl configuration directory will be /usr/local/etc