[freetds]
[freetds-Patches-731907]Choosingdatalengthwhenbindingfixed types
Frediano Ziglio
freddyz77 at tin.it
Thu May 8 07:14:28 EDT 2003
Il mer, 2003-05-07 alle 17:43, Arnar Birgisson ha scritto:
> > Hope that clears things up a bit. :-)
>
> It does indeed.. thanks.
>
> According to this though, is that tds_set_column_type should have
> checked to see if we're speaking tds 7+ and in that case map SYBVARCHAR
> to XSYBVARCHAR, and vice versa for lower versions of the protocol? Is
> there any reason to keep the ability to specify SYBVARCHAR (the old one)
> explicitly when talking tds 7+ ?
>
> Arnar
>
Well, you as client didn't know the protocol version you are talking...
You call dblib passing SQLVARCHAR (or whatever constant) and
libTDS/DB_Library should do all necessary to pass XSYBVARCHAR.
tds_set_column_type was written to set type from server but used
nowadays to set type TO server. If is our intention to set param type we
should do a wrapper in libTDS like this:
void
tds_set_param_type(TDSSOCKET * tds, TDSCOLINFO * curcol, TDS_SERVER_TYPE
type)
{
/* translate type to best handle server */
if (IS_TDS7_PLUS(tds))
switch(type) {
case SYBVARCHAR:
type = XSYBVARCHAR;
break;
case SYBCHAR:
type = XSYBCHAR;
break;
case SYBBINARY:
...
case SYBVARBINARY:
...
}
tds_set_column_type(curcol, type);
}
Removing cardinal type only from tds_set_param_type isn't a good idea...
freddy77
More information about the FreeTDS
mailing list