freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: PHP's mssql_fetch_row inserting '\0' on strings ?
- From: Andre Costa <brblueser AT uol.com.br>
- To: "TDS Development Group" <freetds AT franklin.metalab.unc.edu>
- Cc: camber AT ais.org, brblueser AT uol.com.br, LowdenJK AT bernstein.com
- Subject: Re: PHP's mssql_fetch_row inserting '\0' on strings ?
- Date: Thu, 20 Jun 2002 15:12:52 -0300
Hi Brian, thks for joining this discussion.
On Wed, 19 Jun 2002 20:03:52 -0400 (EDT)
Brian Bruns <camber AT ais.org> wrote:
> pedantic note, it would be --with-sybase or --with-sybase-ct for dblib
> and ctlib respectively. You can see how it was built by checking the
> config.status file.
I don't have it anymore... but, as I told on my reply to James' msg, I
used ./configure --with-sybase=/usr/local/freetds , so it's safe to assume
we're using dblib, right?
BTW: any advantage of using one instead of the other?
> The sybase module(s) in PHP where built with sybase in mind (duh) and
> not necessarily with TDS 7.0 feature such as nvarchars. So while I'd
> usually suspect FreeTDS over PHP (PHP is a more mature code base than
> FreeTDS, and gets more "eyeballs" looking at it), in this case the
> problem could be in either camp. A good way to tell (though not
> definitive) is if both APIs (dblib, ctlib) run into the problem or not.
Makes sense. I will try to recompile PHP using --with-sybase-ct and see if
results differ.
> Part of the problem is that PHP does not simply store strings as null
> terminated arrays (otherwise, what was beyond the first null would be
> irrelevant).
I was expecting that as well.
> I'm going to take a wild guess that the size of the
> resultant data (with all those nulls) is twice the size of the data?
Bingo! Nice shot =) Yes, resultant data with embedded \0s is twice the
size of the "right" data. So, this proves the assumptions that UCS-2 vs.
ASCII is the source of the confusion, doesn't it? Maybe PHP is allocating
a buffer for UCS-2 data and is indeed receiving ASCII?
Looks like we're narrowing the probl down =)
> If so, dbdatlen() or it's ctlib counterpart (length bind) is a possible
> culprit in FreeTDS, but we need a bit more info.
Great. Just let me know how I can help any further, I will be glad to do
it.
Thks for the help.
Best,
Andre
-
Re: PHP's mssql_fetch_row inserting '\0' on strings ?,
Andre Costa, 06/19/2002
- <Possible follow-up(s)>
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, James K . Lowden, 06/19/2002
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, Brian Bruns, 06/19/2002
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, Andre Costa, 06/20/2002
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, Andre Costa, 06/20/2002
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, Brian Bruns, 06/20/2002
- Re: PHP's mssql_fetch_row inserting '\0' on strings ?, Andre Costa, 06/20/2002
Archive powered by MHonArc 2.6.24.