Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some more checks and fixes on type information.

Add some tests for new mssql date/time.
Fix some type information for these types.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  • Loading branch information...
commit 65d525aff35bdb3e2c1f11eed996954d1c0b538d 1 parent 6a8d939
@freddy77 freddy77 authored
Showing with 45 additions and 0 deletions.
  1. +9 −0 src/odbc/odbc_util.c
  2. +36 −0 src/odbc/unittests/describecol.in
View
9 src/odbc/odbc_util.c
@@ -941,6 +941,14 @@ odbc_set_sql_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_v
SET_INFO("sql_variant", "", "");
break;
#endif
+ case SYBMSDATETIMEOFFSET:
+ SET_INFO2("datetimeoffset", "'", "'", col->column_prec + 27);
+ case SYBMSDATETIME2:
+ SET_INFO2("datetime2", "'", "'", col->column_prec + 20);
+ case SYBMSTIME:
+ SET_INFO2("time", "'", "'", col->column_prec + 9);
+ case SYBMSDATE:
+ SET_INFO2("date", "'", "'", 10);
case SYBMSXML:
SET_INFO("xml", "'", "'");
}
@@ -1453,6 +1461,7 @@ odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord * drec, int ch
switch (drec->sql_desc_type) {
case SQL_C_NUMERIC:
+ drec->sql_desc_length = 38;
drec->sql_desc_precision = 38;
drec->sql_desc_scale = 0;
break;
View
36 src/odbc/unittests/describecol.in
@@ -555,6 +555,7 @@ set DESC_PRECISION 2
set DESC_SCALE 2
select time(4) '12:34:56'
attr SQL_DESC_SCALE 4
+attr SQL_DESC_LENGTH 13
attr SQL_DESC_PRECISION 4
attr SQL_DESC_CONCISE_TYPE -154
attr SQL_DESC_TYPE -154
@@ -563,25 +564,60 @@ set DESC_PRECISION 2
set DESC_SCALE 2
select datetime2(4) '12:34:56'
attr SQL_DESC_SCALE 4
+attr SQL_DESC_LENGTH 24
attr SQL_DESC_PRECISION 4
attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP
attr SQL_DESC_TYPE SQL_DATETIME
+attr SQL_DESC_TYPE_NAME datetime2
set DESC_PRECISION 2
set DESC_SCALE 2
select datetimeoffset(4) '12:34:56'
attr SQL_DESC_SCALE 4
+attr SQL_DESC_LENGTH 31
attr SQL_DESC_PRECISION 4
attr SQL_DESC_CONCISE_TYPE -155
attr SQL_DESC_TYPE -155
+attr SQL_DESC_TYPE_NAME datetimeoffset
+
+set DESC_PRECISION 2
+set DESC_SCALE 2
+select time(3) '12:34:56'
+attr SQL_DESC_SCALE 3
+attr SQL_DESC_LENGTH 12
+attr SQL_DESC_PRECISION 3
+attr SQL_DESC_CONCISE_TYPE -154
+attr SQL_DESC_TYPE -154
+
+set DESC_PRECISION 2
+set DESC_SCALE 2
+select datetime2(3) '12:34:56'
+attr SQL_DESC_SCALE 3
+attr SQL_DESC_LENGTH 23
+attr SQL_DESC_PRECISION 3
+attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP
+attr SQL_DESC_TYPE SQL_DATETIME
+attr SQL_DESC_TYPE_NAME datetime2
+
+set DESC_PRECISION 2
+set DESC_SCALE 2
+select datetimeoffset(3) '12:34:56'
+attr SQL_DESC_SCALE 3
+attr SQL_DESC_LENGTH 30
+attr SQL_DESC_PRECISION 3
+attr SQL_DESC_CONCISE_TYPE -155
+attr SQL_DESC_TYPE -155
+attr SQL_DESC_TYPE_NAME datetimeoffset
set DESC_PRECISION 2
set DESC_SCALE 2
select date '2011-08-06'
attr SQL_DESC_SCALE 0
+attr SQL_DESC_LENGTH 10
attr SQL_DESC_PRECISION 0
attr SQL_DESC_CONCISE_TYPE SQL_TYPE_DATE
attr SQL_DESC_TYPE SQL_TYPE_DATE
+attr SQL_DESC_TYPE_NAME date
# some additional tests using ARD

0 comments on commit 65d525a

Please sign in to comment.
Something went wrong with that request. Please try again.