[freetds] type, type and still... type
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Fri Jun 22 04:19:19 EDT 2007
Fixing problem with Sybase 15 and LONGCHAR reveals that there are some
deep dependency from some TDS_COLUMN fields:
- column_type
- column_size
- column_varint_size
- onserver.column_type
- onserver.column_size
- column_nullable
It seems that from combination of tds protocol version and
onserver.column_type we can derive mostly (all apart column_size) of
these fields. So mainly:
- column_type is some sort of libTDS type derived from
onserver.column_type and tds protocol (also called "cardinal type")
- onserver.column_type is the constant readed from/written to server
- column_nullable depends mostly from onserver.column_type
- column_varint_size depends from onserver.column_type and tds protocol
like column_type
- onserver.column_size is the largest size readed from server or, for
fixed type, the size derived from onserver.column_type and tds protocol
- column_size is mostly onserver.column_size apart when a character
conversion is required
Just to add some complication there is also a "conversion type" used by
tds_convert where we remove nullable types (like SYBINTN). There is also
a similar type used in ctlib (parameters are specified by sized int,
never by variable sized int!).
The results are:
- it's quite complicate to check for size and type (see tds_check.c) and
this lead to inconsistency
- there are a lot of conversion between different types
- it's not easy to understand when to use onserver.column_type instead
of column_type
- why column_varint_size and not onserver.column_varint_size ??
Well... it currently works but IMHO is too complicated!
Why not define a libTDS type like cardinal type??
freddy77
More information about the FreeTDS
mailing list