#35536 [Fbk->Opn]: mysql_field_type returns unknown for INT(11) columns

From: Date: Sun, 04 Dec 2005 18:02:38 +0000
Subject: #35536 [Fbk->Opn]: mysql_field_type returns unknown for INT(11) columns
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89720@lists.php.net to get a copy of this message
 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:

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;


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

[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


Thread (14 messages)

« previous php.bugs (#89720) next »