Skip to content

Commit

Permalink
Some more checks and fixes on type information.
Browse files Browse the repository at this point in the history
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
freddy77 committed Feb 24, 2014
1 parent 6a8d939 commit 65d525a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/odbc/odbc_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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", "'", "'");
}
Expand Down Expand Up @@ -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;
Expand Down
36 changes: 36 additions & 0 deletions src/odbc/unittests/describecol.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 65d525a

Please sign in to comment.