Skip to Content.
Sympa Menu

freetds - Re: Fix for VARBINARY

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: "TDS Development Group" <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: Fix for VARBINARY
  • Date: Sun, 17 Nov 2002 12:32:54 -0500


On 17 Nov 2002 11:07:15 +0100, Frediano Ziglio <freddyz77 AT tin.it> wrote:
> This type had many problems:
> - conversions to VARBINARY was unavailable
> - unsupported VARBINARY > 255 (mssql7+)
> (also a bad buffer overflow was spotted)
> This was fixed saving VARBINARY in libtds in the same way of BINARY (a
> simple array of bytes). This has some drawbacks:
> - conversion to VARBINARY are trivial (the good one)

All good!

> - libraries should handle "conversion" from libtds VARBINARY to library
> VARBINARY.

Not clear to me. Could you point to the lines in convert.c, please?

> It seem that dblib/ctlib do not return VARBINARY type.. quite
> strange.

Sybase db-lib documentation for dbcoltype:

In a few cases, the token value returned by this routine may
not correspond exactly with the column's server datatype:
· SYBVARCHAR is returned as SYBCHAR.
· SYBVARBINARY is returned as SYBBINARY.
· SYBDATETIMN is returned as SYBDATETIME.
· SYBMONEYN is returned as SYBMONEY.
· SYBFLTN is returned as SYBFLT8.
· SYBINTN is returned as SYBINT1, SYBINT2, or SYBINT4,
depending on the actual type of the SYBINTN.

and dbconvert:

A conversion to or from the datatypes SYBBINARY and SYBIMAGE is
a straight bit-copy, except when the conversion involves SYBCHAR
or SYBTEXT. When converting SYBCHAR or SYBTEXT data to
SYBBINARY or SYBIMAGE, DBCONVERT interprets the SYBCHAR or
SYBTEXT string as hexadecimal, whether or not the string contains
a leading "0x". When converting SYBBINARY or SYBIMAGE data to
SYBCHAR or SYBTEXT, dbconvert creates a hexadecimal string
without a leading "0x".


Frediano, do you think this will help Paul Kiela? Were we lying about the
length of a returned buffer? Not that that should result in a segfault in
PHP.

Chris's data have no binary types. All numeric, char, and datetime
AFAICT. I think I misled you; he *does* use numeric conversion. See my
message to him on 14 November.

Reagrds,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page