From: danielc at analysisandsolutions dot com
Operating system: Windows 2000
PHP version: 5CVS-2004-06-24 (dev)
PHP Bug Type: MySQL related
Bug description: MYSQLI_TYPE_STRING != mysqli_fetch_field() type for VARCHAR column
Description:
------------
The "type" value returned from mysqli_fetch_field() for a VARCHAR field is
253. The manual says the constant for VARCHAR fields is MYSQLI_TYPE_STRING
which has a value of 254. So, there's no way to determine column types via
constants for VARCHAR's.
Reproduce code:
---------------
mysqli_query($db->connection,
'CREATE TABLE bar (Cf VARCHAR(5))');
$r = mysqli_query($db->connection,
'SELECT Cf FROM bar');
$tmp = mysqli_fetch_field($r);
echo "type found = $tmp->type\n";
echo 'MYSQLI_TYPE_STRING = ' . MYSQLI_TYPE_STRING . "\n";
mysqli_query($db->connection,
'DROP TABLE bar');
Expected result:
----------------
type found = 254
MYSQLI_TYPE_STRING = 254
Actual result:
--------------
type found = 253
MYSQLI_TYPE_STRING = 254
--
Edit bug report at http://bugs.php.net/?id=28912&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28912&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28912&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28912&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28912&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28912&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28912&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28912&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28912&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28912&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28912&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28912&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28912&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28912&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28912&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28912&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28912&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28912&r=float