Skip to content

Commit

Permalink
dblib: fix compatibility problem with old protocol
Browse files Browse the repository at this point in the history
Detect if the protocol we are using is not enough to return
DATETIME2. In this case database convert it to CHAR and return.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  • Loading branch information
freddy77 committed Nov 22, 2015
1 parent 82dbca6 commit ba54c92
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dblib/unittests/t0012.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,18 @@ main(int argc, char *argv[])
dbresults(dbproc);

while (dbnextrow(dbproc) != NO_MORE_ROWS) {
int type = dbcoltype(dbproc, 1);

++output_count;
/* Print the date info */
dbconvert(dbproc, dbcoltype(dbproc, 1), dbdata(dbproc, 1), dbdatlen(dbproc, 1), SYBCHAR, (BYTE*) datestring, -1);
dbconvert(dbproc, type, dbdata(dbproc, 1), dbdatlen(dbproc, 1), SYBCHAR, (BYTE*) datestring, -1);

printf("%s\n", datestring);

/* network not high enough for this type ! */
if (type == SYBCHAR || type == SYBVARCHAR)
break;

/* Break up the creation date into its constituent parts */
if (dbanydatecrack(dbproc, &dateinfo2, dbcoltype(dbproc, 1), dbdata(dbproc, 1)) != SUCCEED)
set_failed();
Expand Down

0 comments on commit ba54c92

Please sign in to comment.