ID: 35536
User updated by: nevis2us at infoline dot su
Reported By: nevis2us at infoline dot su
-Status: Feedback
+Status: Open
Bug Type: MySQL related
Operating System: Linux Gentoo
PHP Version: 4.4.1
New Comment:
Actually the first thing I did.
The Client API version is 5.0.16 (mysql_get_client_info)
The server is 5.0.16-log (mysql_get_server_info)
Previous Comments:
------------------------------------------------------------------------
[2005-12-04 21:39:27] tony2001@php.net
Round 2:
please check the version number of mysqlclient used with PHP.
------------------------------------------------------------------------
[2005-12-04 19:02:36] nevis2us at infoline dot su
Sorry for the first hasty report. It was misleading at best.
Here comes a simple test which hopefully may help to troubleshoot the
actual problem I'm having with
PHP 4.4.1(gentoo dev-lang/php-4.4.1-r2 ebuild) and
MySQL 5.0.16(gentoo dev-db/mysql-5.0.16-r3 ebuild)
CREATE TABLE test.tmp (x INT, y DECIMAL, z REAL);
INSERT INTO test.tmp VALUES (1, 1, 1);
SELECT x, y, z FROM test.tmp;
-- column types as returned by mysql_field_type
-- for relevant columns in the resource set
-- int unknown real
-- 1 1 1
SELECT SUM(x), SUM(y), SUM(z) FROM test.tmp;
-- unknown unknown real
-- 1 1 1
SELECT ROUND(x), ROUND(y), ROUND(z) FROM test.tmp;
-- int unknown real
-- 1 1 1
SELECT AVG(x), AVG(y), AVG(z) FROM test.tmp;
-- unknown unknown real
-- 1.0000 1.0000 1
SELECT MIN(x), MIN(y), MIN(z) FROM test.tmp;
-- int unknown real
-- 1 1 1
SELECT x/2, y/2, z/2 FROM test.tmp;
-- unknown unknown real
-- 0.5000 0.5000 0.5
DROP TABLE test.tmp;
------------------------------------------------------------------------
[2005-12-03 23:08:03] tony2001@php.net
Works perfectly fine here.
Please check which mysqlclient libs your PHP uses: they has to be of
the same version as the server.
------------------------------------------------------------------------
[2005-12-03 22:33:58] nevis2us at infoline dot su
Description:
------------
mysql_field_type returns 'unknown' for INT(11) columns
in MySQL 5.0.16 Same results with PHP 5.0.5
No problems with MySQL 4.1.15
Also works for decimal types in 5.0
Reproduce code:
---------------
Call mysql_field_type for an INT column in MySQL 5.0.16
Expected result:
----------------
Should return 'int'
Actual result:
--------------
'unknown'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35536&edit=1