[freetds] developer issue: BCP_COLINFO
James K. Lowden
jklowden at schemamania.org
Sat Apr 19 14:09:38 EDT 2003
I spent quite a bit of the weekend going over bcp.c tracking down
UTF-8 issues. I noticed that BCP_COLINFO functionally duplicates
TDSCOLINFO, making the code harder (for me at least) to understand.
More important, as TDSCOLINFO info changes to support iconv, those
same changes are going to have to be re-invented in BCP_COLINFO.
It would be nice IMO if someone had the time to rip out BCP_COLINFO
and replace it with TDSCOLINFO. If nothing else, I'll do that when I
migrate bcp.c from db-lib to libtds, in preparation for blk-lib use.
(I also think the "column_" prefix should go.)
Here's my analysis of the two structures.
data column_offset // semantically different
db_minlen // not used
db_maxlen // not used
db_colcnt // not used
db_status // not used
db_offset // not used
db_default // not used
db_size // not used
As you can see, BCP_COLINFO has many fields not in TDSCOLINFO, but
only one of these is used.
I also noticed that DBPROCESS::bcp_columns is an array of pointers to
BCP_COLINFO structures. It turns out, however, that we always know
how many columns there are, so we could allocate an array of structs
directly, gaining some efficiency and losing one level of
For completeness, here are the TDSCOLINFO members not represented in
More information about the FreeTDS