Skip to Content.
Sympa Menu

freetds - Re: VAR or not VAR?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: VAR or not VAR?
  • Date: Mon, 19 Aug 2002 11:07:54 -0400


the handling of char/varchar does differ, at least in dblib. there are a
couple of unittests in the dblib directory that demonstrate/test this
behaviour.

> Our code act the same way for char/varchar (similar to varbinary/binary):
> - read from wire
> - terminating (I hope this won't be needed...)
> - returning string.
>
> I note that ODBC threat varchar as a dinamic len string and char as static
> len.
> If I take '1234' and convert I obtain these result
> '1234' -> varchar(8) -> '1234'
> '1234' -> char(8) -> '1234 ' (padded with space)
> similar for binary/varbinary
> 0x1234 -> varbinary(4) -> 0x1234
> 0x1234 -> binary(4) -> 0x12340000 (padded with zero)
>
> Can anyone test with other original libraries (ctlib and dblib) this stuff ?
> (I think I'll do a test with dblib/mssql, for other.. I don't know)
> I suppose ODBC is not the unique library that threat things on this way..
>
> If this is true it can be changed just in token.c...
>
> Also note that calling cs_convert it use column_size instead of cur_row_size
> for source len... I think is a bit broken and the cause of garbage in PHP.
>
> freddy77
>
> =================================
> "STRICTLY PERSONAL AND CONFIDENTIAL
>
> This message may contain confidential and proprietary material for the sole
> use of the intended recipient. Any review or distribution by others is
> strictly prohibited. If you are not the intended recipient please contact
> the sender and delete all copies.
> The contents of this message that do not relate to the official business of
> our company shall be understood as neither given nor endorsed by it."
>
> =================================



  • VAR or not VAR?, ZIGLIO Frediano, 08/19/2002
    • <Possible follow-up(s)>
    • Re: VAR or not VAR?, Brian Bruns, 08/19/2002

Archive powered by MHonArc 2.6.24.

Top of Page