Skip to Content.
Sympa Menu

freetds - RE: turn off padding of CHAR with spaces?

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: turn off padding of CHAR with spaces?
  • Date: Wed, 18 Sep 2002 10:22:56 -0400


> From: Chris Hernandez [mailto:christian AT unsw.edu.au]
> Sent: September 18, 2002 4:57 AM
>
> I've recently upgraded my FreeTDS to version 0.60 and now
> find that when I
> run a SELECT query from PHP, the reply now comes back padded
> with spaces
> to the length of the field on the database. This did not happen
> previously.

Chris,

I think we carefully fixed a bug you were using. Thanks for pointing this
out. I'm sorry you weren't alerted to the new behavior; it should have been
in the release notes.

A lot of work went into datatypes and type conversion in 0.60, and part of
it was assessing what we were doing with character types and their
terminators. ISTR we had been -- incorrectly -- null-terminating
char/varchar fields in many cases. This was corrected, and to the best of
my knowledge FreeTDS now conforms on this score to the vendors'
documentation.

It may nevertheless be that we are doing something wrong. The dblib
dbbind() documentation states that char/varchar fields will be blank padded
for CHARBIND and STRINGBIND bindings, but will be null-terminated for
NTBSTRINGBIND. I am not positive we tested our NTBSTRINGBIND behavior in
this regard, nor do I know what PHP uses. I will double-check our dblib
behavior for you when I get a chance.

Which API did you configure PHP to use, please? It could easily be an error
in one or another client library.

If we're indeed following the vendors' specification, we cannot restore the
previous behavior. To do so would interfere with our progress toward
handling multibyte character sets and binary compatibility.

Unless we find an error in our implementation, I think your best bet is to
trim your data with SQL, or patch PHP to use NTBSTRINGBIND.

Regards,

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.






Archive powered by MHonArc 2.6.24.

Top of Page