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: "Thompson, Bill D (London)" <bill_d_thompson AT ml.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Removal of trailing spaces by FreeTDS
  • Date: Fri, 14 Nov 2003 13:29:17 -0000

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





Archive powered by MHonArc 2.6.24.

Top of Page