ID:               33154
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jroyer at omegafi dot com
-Status:           Open
+Status:           Feedback
-Bug Type:         MSSQL related
+Bug Type:         Sybase (dblib) related
 Operating System: Red Hat ES 4
 PHP Version:      5.0.4
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Try --with-sybase-ct or --with-mssql instead of --with-sybase.
(both accept same path as you used for --with-sybase!)



Previous Comments:
------------------------------------------------------------------------

[2005-05-26 20:03:14] jroyer at omegafi dot com

Description:
------------
We are using PHP 5.0.4/Apache 2.0.54 with FreeTDS 0.63 against a SQL
Server 2000 server.  When fetching money or smallmoney fields from the
database, the return value is a string of size 28 or 24 respectively. 
This problem has surfaced when upgrading our web servers from 4.3.2 to
5.0.4.  Version 4.3.2 behaves as expected.

I have used the php.ini-dist out of the box to produce this problem. 
The configure line is as follows: 

./configure \
        --with-apxs2=/usr/local/apache/bin/apxs \
        --enable-bcmath \
        --enable-wddx \
        --with-config-file-path=/etc/php4/cgi \
        --with-xml \
        --with-zlib \
        --enable-memory-limit \
        --with-sybase=/usr/local/freetds \
        --enable-magic-quotes=yes \
        --enable-force-cgi-redirect \
        --with-gd \
        --enable-gd-native-ttf \
        --with-zlib-dir=/usr/include \
        --with-jpeg-dir=/usr \
        --with-png-dir=/usr \
        --with-cpdflib=/usr/local \
        --with-ttf=/usr \
        --with-mysql=/usr/include/mysql \
        --with-freetype_dir=/usr/include/freetype2

Reproduce code:
---------------
mssql_connect("Server", "UserName","Password");
mssql_select_db("Database");

$sql="Select SmallMoneyField from Table";
$result = mssql_query($sql);
$row = mssql_fetch_array($result);

while ($row = mssql_fetch_array($result)) {
        $data[] .= $row["SmallMoneyField"];
        echo $row["TransactionAmount"];
 }

echo strlen($ydata[1]) . '<br>';

Expected result:
----------------
When the code is executed I expect to see a return of a money field
with a string length equalling the number of digits (ex. "5.00" should
be string length of 4).  Output of the string, when viewing the browser
source, shows a number followed by spaces.

Actual result:
--------------
For money fields I get a string length of 28, regardless of the actual
number length and a string length of 24 for smallmoney fields.  Other
fields, such as text, varchar and integers behave as expected with
values matching the number of digits/characters.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33154&edit=1

Reply via email to