#26828 [Com]: queried bit fields are space-padded
ID: 26828
Comment by: asuter at vianetworks dot ch
Reported By: jim dot hatfield at insignia dot com
Status: Bogus
Bug Type: Sybase (dblib) related
Operating System: FreeBSD 4.5-RELEASE
PHP Version: 4.3.4
Assigned To: iliaa
New Comment:
hello,
I have the same problem with php 4.3.4 connecting to mssql 2000 from
linux using dblib + freetds 0.61
all "bit" and "datetime" fields are padded with spaces when results are
returned. previously I used php 4.2.3 which hadn't that problem.
Previous Comments:
------------------------------------------------------------------------
[2004-01-09 09:13:01] jim dot hatfield at insignia dot com
I have read #26835 and don't see how it is similar.
Also #26835 refers to VARCHAR types, whereas this is
for a BIT type.
I'm confused. How can padding a BIT with 19 spaces
be right? It means that in the example, if I say
if ($row[1])
then it always evaluates TRUE. I have to coerce to int
first to get the code to work. This is code which has been
working fine since mid-2002.
------------------------------------------------------------------------
[2004-01-09 08:50:34] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Not a bug.
Read previous similar reports such as #26835, etc...
------------------------------------------------------------------------
[2004-01-07 21:27:35] sniper@php.net
See bug #25777 (assigning this to Ilia who removed this trimming from
ext/sybase)
------------------------------------------------------------------------
[2004-01-07 09:19:37] jim dot hatfield at insignia dot com
Description:
------------
Retrieve one row from a Sybase database using
DB-Lib and Freetds 0.61_1.
"manager" is a smallint and "ts_admin" is a "bit".
The first record has field values 1 and 0 for these
fields respectively.
I did a "portupgrade lang/php4" between the two runs so I know the only
thing which changed was the PHP version.
Reproduce code:
---------------
$db = sybase_connect($server, $user, $pass);
sybase_select_db($dbname, $db);
res =
$sybase_query("select manager, ts_admin from employees", $db)
$row = sybase_fetch_row($res);
echo "Manager = \"$row[0]\"\n";
echo "TS_Admin = \"$row[1]\"\n";
Expected result:
----------------
4.3.3 returns:
Manager = "1"
TS_Admin = "0"
Actual result:
--------------
4.3.4 returns:
Manager = "1"
TS_Admin = "0 "
note the space padding. When tested in
an if this returns TRUE when without the
padding it is FALSE
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26828&edit=1
Thread (5 messages)