Skip to Content.
Sympa Menu

freetds - RE: [freetds] Removal of trailing spaces by FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Simon Talbot" <simont AT nse.co.uk>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Removal of trailing spaces by FreeTDS
  • Date: Fri, 14 Nov 2003 13:37:12 -0000

We are doing parallel testing with DBLibrary under Windows and Linux and
the Windows version returns the space and the Unix version doesn't --
typical

I assume it would be relatively trivial to include a flag to
enable/disable this behaviour for Sybase/Microsoft compatibility --
maybe the flag is already there?

Simon


-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Thompson, Bill D
(London)
Sent: 14 November 2003 13:29
To: 'FreeTDS Development Group'
Subject: RE: [freetds] Removal of trailing spaces by FreeTDS

HI Simon,

I'm afraid that this is how it's *supposed* to behave.
The manuals aren't really explicit on some behaviours, but we did a LOT
of work in this area a year or so back.
I personally did detailed parallel testing of programs compiled with
Sybase open client db-library and our own.
In this case, w e have just reproduced the behaviours of Sybase
db-library with respect to varchar data and the NTBSTRINGBIND argument
to dbbind.

Bill

> -----Original Message-----
> From: Simon Talbot [SMTP:simont AT nse.co.uk]
> Sent: 14 November 2003 13:17
> To: FreeTDS Development Group
> Subject: [freetds] Removal of trailing spaces by FreeTDS
>
> Hi All,
>
> I have observed the following with both the stable and the dev version

> of FreeTDS.
>
> Communicating with a Win2000 SQL Server 2000 from FreeTDS on Linux
> 2.4.22, using code like:
>
> DBCHAR P_TEXT[6000];
>
> ...
>
> Connect and issue query etc.
>
> ...
>
> dbresults(dbconn);
>
> dbbind(dbconn, 4, NTBSTRINGBIND, 0, (BYTE *)&P_TEXT);
>
> /* Loop thru the result set */
> while (dbnextrow(dbconn) != NO_MORE_ROWS)
> {
> printf("Text:%s:\n",P_TEXT)
> }
>
> ...
>
> Close database connection etc.
>
>
> The column that the dbbind is binding to is of type varchar(6000).
>
> Data is returned correctly apart from the following:
>
> If the last character of the VARCHAR data is a space (0x20) this last
> character is not returned into P_TEXT. If the last character is
> anything else there is not a problem.
>
> For example if the field conatined (note ' marks are for illustration
> only, they are not in the actual field data):
>
> '!20 michigan mini cooper , volvo ' -- P_TEXT would incorrectly
> contain '!20 michigan mini cooper , volvo'
>
> Whereas if the field conatined:
>
> '!20 michigan mini cooper , volvo :' -- P_TEXT would correctly contain

> '!20 michigan mini cooper , volvo :'
>
>
> Thoughts ?
>
> Simon
>
> Simon Talbot MEng, ACGI
> (Chief Engineer)
> Net Solutions Europe Limited
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds






Archive powered by MHonArc 2.6.24.

Top of Page