freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] db-lib: support for new MS SQL 2008 data types - part 4
- From: LacaK <lacak AT zoznam.sk>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] db-lib: support for new MS SQL 2008 data types - part 4
- Date: Wed, 21 May 2014 13:47:22 +0200
Hi,
please see attached small patches, which introduce new constant DATETIME2BIND used for supporting binding to local variables of type TDS_DATETIMEALL.
Any comment welcome of course.
Thanks
-Laco.
--- sybdb.h.ori Sun May 18 10:41:16 2014
+++ sybdb.h Wed May 21 13:30:54 2014
@@ -459,7 +459,7 @@ typedef int (*MHANDLEFUNC) (DBPROCESS *
#define STRINGBIND 1
#define NTBSTRINGBIND 2
#define VARYCHARBIND 3
-#define VARYBINBIND 4
+#define VARYBINBIND 4
#define TINYBIND 6
#define SMALLBIND 7
#define INTBIND 8
@@ -474,7 +474,8 @@ typedef int (*MHANDLEFUNC) (DBPROCESS *
#define NUMERICBIND 17
#define DECIMALBIND 18
#define BIGINTBIND 30
-#define MAXBINDTYPES 31 /* keep last */
+#define DATETIME2BIND 31
+#define MAXBINDTYPES 32 /* keep last */
#define DBPRCOLSEP 21
#define DBPRLINELEN 22
--- dblib.c.ori Sun May 18 10:41:16 2014
+++ dblib.c Wed May 21 13:38:42 2014
@@ -452,6 +452,7 @@ static const DBDATETIME4 null_SMALLDATET
static const DBMONEY null_MONEY = { 0, 0 };
static const DBMONEY4 null_SMALLMONEY = {0};
static const DBNUMERIC null_NUMERIC = { 0, 0, {0} };
+static const TDS_DATETIMEALL null_DATETIMEALL = { 0, 0, 0, 0 };
static NULLREP default_null_representations[MAXBINDTYPES] = {
/* CHARBIND 0 */ { NULL, 0 }
@@ -485,7 +486,8 @@ static NULLREP default_null_representati
/* 28 */ , { NULL, 0 }
/* 29 */ , { NULL, 0 }
/* BIGINTBIND 30 */ , { (BYTE*) &null_BIGINT,
sizeof(null_BIGINT) }
- /* MAXBINDTYPES 31 */
+ /* DATETIME2BIND 31 */ , { (BYTE*) &null_DATETIMEALL,
sizeof(null_DATETIMEALL) }
+ /* MAXBINDTYPES 32 */
};
static int
@@ -518,7 +520,13 @@ dbbindtype(int datatype)
case SYBMONEY: return MONEYBIND;
case SYBMONEY4: return SMALLMONEYBIND;
-
+
+ case SYBMSDATE:
+ case SYBMSTIME:
+ case SYBMSDATETIME2:
+ case SYBMSDATETIMEOFFSET:
+ return DATETIME2BIND;
+
default:
assert(0 == "no such datatype");
}
@@ -2157,6 +2165,9 @@ dblib_bound_type(int bindtype)
case DECIMALBIND:
return SYBDECIMAL;
break;
+ case DATETIME2BIND:
+ return SYBMSDATETIME2;
+ break;
default:
return -1;
break;
@@ -7321,6 +7332,14 @@ copy_data_to_host_var(DBPROCESS * dbproc
memcpy(dest, src, ret);
break;
+ case SYBMSDATE:
+ case SYBMSTIME:
+ case SYBMSDATETIME2:
+ case SYBMSDATETIMEOFFSET:
+ ret = sizeof(TDS_DATETIMEALL);
+ memcpy(dest, src, ret);
+ break;
+
default:
break;
}
@@ -7427,6 +7446,12 @@ copy_data_to_host_var(DBPROCESS * dbproc
break;
case SYBUNIQUE:
memcpy(dest, &(dres.u), sizeof(TDS_UNIQUE));
+ break;
+ case SYBMSDATE:
+ case SYBMSTIME:
+ case SYBMSDATETIME2:
+ case SYBMSDATETIMEOFFSET:
+ memcpy(dest, &(dres.dta), sizeof(TDS_DATETIMEALL));
break;
case SYBCHAR:
case SYBVARCHAR:
-
[freetds] db-lib: support for new MS SQL 2008 data types - part 4,
LacaK, 05/21/2014
-
Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4,
Frediano Ziglio, 05/25/2014
-
Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4,
LacaK, 05/26/2014
-
Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4,
Frediano Ziglio, 05/26/2014
- Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4, LacaK, 05/26/2014
-
Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4,
Frediano Ziglio, 05/26/2014
-
Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4,
LacaK, 05/26/2014
-
Re: [freetds] db-lib: support for new MS SQL 2008 data types - part 4,
Frediano Ziglio, 05/25/2014
Archive powered by MHonArc 2.6.24.