[freetds] db-lib: support for new MS SQL 2008 data types - part 2

LacaK lacak at zoznam.sk
Fri Apr 4 06:00:16 EDT 2014


Now I can read successfuly:
- dbcoltype() returning SYBMSDATE, SYBMSTIME, SYBMSDATETIME2

I am trying do next small step.
As far as I understand dbdata() function for SYBMSDATE, SYBMSTIME, 
SYBMSDATETIME2 return pointer to TDS_DATETIMEALL struct.
(dbdata() internally uses: return (BYTE *) colinfo->column_data)

If it is so I need some way how to convert TDS_DATETIMEALL struct to 
DBDATEREC struct.
(which is good readable)

There is already function:
  dbdatecrack(DBPROCESS * dbproc, DBDATEREC * output, DBDATETIME * 
datetime)
but it takes as 3rd parameter DBDATETIME struct, which is struct used by 
old "datetime" data type SYBDATETIME)

So my idea is introduce new API function:
  tdsdbdatecrack(DBPROCESS * dbproc, INT datetype, DBDATEREC * output, 
const void *datetime)
(like we have tdsdbopen() vs dbopen())
Where datetime can be pointer to either old DBDATETIME or new 
TDS_DATETIMEALL, depending on datetype supplied

What is your opinion on that?
I am asking for sure about every step, because I am not so familiar with 
internals.

Thanks
-Laco.


More information about the FreeTDS mailing list