freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: PHP's mssql_fetch_row inserting '\0' on strings ?
- From: "Lowden, James K" <LowdenJK AT bernstein.com>
- To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
- Subject: Re: PHP's mssql_fetch_row inserting '\0' on strings ?
- Date: Wed, 19 Jun 2002 14:54:50 -0400
> From: Andre Costa [mailto:brblueser AT uol.com.br]
> Sent: June 19, 2002 1:41 PM
>
> "thank you very much" ;)
My pleasure. Several things are happening at once, so I've been more active
here. I'm interested in rooting out anything we can find wrong in the code
or documentation while we're preparing a new release. And I'm trying to
fill in for Brian, who is justly distracted by Life for the time being.
> > The function (dbbind, whatever) also returns a length. Like any
> > partially used buffer, the data beyond that length are
> > undefined.
>
> Mmmh... this could be it. It could be that this function is
> returning a \0
> marker *and* a length, and they don't match. Anyway, this
> could be PHP's
> fault, since I am not using the latest version. I will see if
> I manage to
> find some time to try a later version.
<snip>
> I still don't understand
> why such strings are being returned by TDS 7.0 instead of
> "plain" strings
> returned by TDS 4.2 for the same command (mssql_fetch_row)
> and the same set of data.
Andre,
I know the answer. See the thread on this list around June 9, Re: Strange
data results....
Your query returns fields of datatype either Text or nvarchar. Change them
to varchar and go home.
TDS 4.2 uses ASCII, one byte/character. TDS 7.0 uses UCS-2, two
bytes/character. Someone's getting confused about the difference between
the buffer length and the number of characters.
I don't know whether this is a PHP bug or a FreeTDS bug. Which API are you
using? If ct-lib, then it's definitely a PHP error, because sqsh handles
them correctly.
Regards,
--jkl
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, Lowden, James K, 06/19/2002
Archive powered by MHonArc 2.6.24.