Skip to Content.
Sympa Menu

freetds - RE: [freetds] [freetds-Patches-731907]Choosingdatalengthwhenbindingfixed types

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] [freetds-Patches-731907]Choosingdatalengthwhenbindingfixed types
  • Date: Thu, 08 May 2003 06:14:28 -0000

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






Archive powered by MHonArc 2.6.24.

Top of Page