Skip to Content.
Sympa Menu

freetds - Re: PHP's mssql_fetch_row inserting '\0' on strings ?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James K. Lowden <jklowden AT speakeasy.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Cc: brblueser AT uol.com.br, LowdenJK AT bernstein.com
  • Subject: Re: PHP's mssql_fetch_row inserting '\0' on strings ?
  • Date: Wed, 19 Jun 2002 19:48:58 -0400


On Wed, 19 Jun 2002 18:15:20 -0300, "Andre Costa" <brblueser AT uol.com.br>
wrote:

> > Your query returns fields of datatype either Text or nvarchar. Change
> > them to varchar and go home.
>
> Cool =) However, I wish it were that simple.
>
> The XML generator we're implementing should not need to be aware of the
> data types it is receiving. Unless I am missing something, I would only
> have two options: [1] query the DB for the type of each field and
> convert TEXT to VARCHAR or [2] convert everything to VARCHAR.

First of all, Andre, am I right? Does the problem go away? I'm going to
assume "yes".

I understand your "should not need to be aware" point. If the problem
lies in FreeTDS, I'd like to fix it. I suspect at this point that it has
to do with the way PHP binds its variables.

You might want to vote for http://bugs.php.net/bug.php?id=16244

In any case, no, I wouldn't suggest coding datatype logic into your
generator. Changing the dataypes in the tables, or making views of them
that convert nchars to chars would be simpler, I'd imagine.

> Could you please point me to any docs describing the difference between
> TDS 4.2 and TDS 7.0? If I don't have a real need for 7.0, I will stick
> to 4.2.

Have you seen doc/tds.html in the source tree?

But I think you're going to be dissatisfied at some point with 4.2. If
you're defining (and need) nvarchar, the limitations of 4.2 are going to
get in your way.

> > I don't know whether this is a PHP bug or a FreeTDS bug. Which API
> > are you using?
>
> ... I must confess I don't know how to answer your question ={ How do I
> check that?

I don't know how to check, except to know how your PHP was put together.
Per our UG, http://www.freetds.org/userguide/x1076.htm did you do your
./configure --with-sybase
or
./configure --with-iodbc=/usr/local

and, if --with-sybase, did you link to the ct or db libraries?

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page