Skip to Content.
Sympa Menu

freetds - RE: [ freetds-Patches-582445 ] Add VARCHAR to conve rt t able

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: [ freetds-Patches-582445 ] Add VARCHAR to conve rt t able
  • Date: Wed, 17 Jul 2002 13:18:15 -0400

> From: Lowden, James K [mailto:LowdenJK AT bernstein.com]
> Sent: July 16, 2002 5:23 PM

> > Patches item #582445, was opened at 2002-07-16 22:08
> > You can respond by visiting:
> > https://sourceforge.net/tracker/?func=detail&atid=407808&aid=5
> > 82445&group_id=33106
> >
> > Convert table (in convert.c) do not handle VARCHAR

Conversion truth table for MS SQL Server 7.0 attached. Of the types that
are present in FreeTDS but not handled in tds_willconvert.h, there are two
sets.

These types are not mentioned in MS's convert documentation or .h:

BITN not distiguished from BIT
INT8
NTEXT
NVARCHAR
UNIQUE
VARIANT

Bill, Brian, what do you think about NTEXT and NVARCHAR? Are they handled
transparently, same as TEXT and VARCHAR? What happens if you convert
VARCHAR to NVARCHAR? Do you get UCS-2 in the output?

Should the convert functions be able to convert to/from UTF-8? We have no
defined type for it.

At present tds_willconvert() returns FALSE for the above types.

These types can be added to tds_willconvert.h based on the attached table:

DATETIMN
FLTN
INTN
MONEYN
VARBINARY
VARCHAR
VOID

What to do? Notes to me when I get back or to anyone else in the meantime,
comments welcome:

* Add varchar (Freddy's patch), and varbinary to the existing truth table.

Prepend these tests to tds_willconvert():

* If either is void, return false. Or ignore it; anything not in the table
returns false.
* If src/dest is nullable type, assign it an equivalent non-null type before
entering the loop:

switch(srctype) {
case: SYBBITN: srctype = SYBBIT; break;
[etc.]
}

... then process normally.

--jkl


BINARY BIT CHAR DATETIM4 DATETIME DATETIMN
DECIMAL FLT4 FLT8 FLTN IMAGE INT1 INT2 INT4 INTN
MONEY MONEY4 MONEYN NUMERIC TEXT VARBINARY VAR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