Re: Compiling Against FreeTDS 0.95 w/7.3 TDSVER Features Possible?

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAHt6W4f8fym1NB6eqy4eOp7MKT0sonMDsu6Lpfe_uyAk08doAw@mail.gmail.com>
2015-11-15 20:14 GMT+00:00 Ken Collins <[email protected]>:
> I am in the process of upgrading the Ruby C extensions to FreeTDS from 0.91 to 0.95.
>
> The primary goal is to also support using TDSVER 7.3 and the newly supported 2008 data types.
>
> Is this possible to use these new types in 0.95 when many of the types are not defined in sybdb.h? For example here is a diff of that file when comparing 0.95 to master. https://gist.github.com/metaskills/4c9900c3d1078e5c4763
>
>
> For example, I can see that dbcoltype() is returning integers that match these below. I can even see the binary data, but I am unsure how what API functions I need to use this data. So far dbdatecrack() is not working. Any recommendations?
>
> SYBMSDATE = 40
>
> SYBMSTIME = 41
>
> SYBMSDATETIME2 = 42
>
> SYBMSDATETIMEOFFSET = 43
>

Yes, actually the patch could be backported (beside the 7.4 stuff).

The binary structure is well defined (and an ABI actually) however is
defined in tds.h (TDS_DATETIMEALL). The date field is the same as
dtdays in DATETIME however
time is completely different (100-nanosecondth from start of day).

dbdatecrack only supports DATETIME. I suppose a new dbanydatecrack (or whatever)
extension could be defined (possibly extending time precision). Or in
the meantime you could pass date field into a DATETIME, use
dbdatecrack and split time manually (at least the precision).

Frediano
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.