#36579 [Opn]: mysqli_fetch_field length handling
| From: | bjori@php.net | Date: | Thu, 02 Mar 2006 01:05:10 +0000 |
| Subject: | #36579 [Opn]: mysqli_fetch_field length handling | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969372172@lists.php.net to get a copy of this message | ||
ID: 36579
Updated by: bjori@php.net
Reported By: lsmith@php.net
Status: Open
Bug Type: Documentation problem
Operating System: windows
PHP Version: 5.1.2
New Comment:
Patch: http://php.is/bugs/36579/phpdoc-mysql.patch.txt
Previous Comments:
------------------------------------------------------------------------
[2006-03-02 01:50:08] bjori@php.net
http://dev.mysql.com/doc/refman/5.0/en/c-api-datatypes.html
"unsigned long length:
The width of the field, as specified in the table definition."
"unsigned long max_length:
The maximum width of the field for the result set (the length of the
longest field value for the rows *actually in the result set*)..."
Since you have no data in there max_length is expected to be zero
Reclassified as documentation bug
------------------------------------------------------------------------
[2006-03-01 23:33:07] lsmith@php.net
Description:
------------
mysqli seems to return the length of the column inside the undocumented
"length" property, whereas max_length seems to be 0 all the time ..
Reproduce code:
---------------
CREATE TABLE
users (
user_name char(12) default NULL,
user_password text,
subscribed tinyint(4) default NULL,
user_id int(11) NOT NULL default '0',
quota decimal(18,2) default NULL,
weight double default NULL,
access_date date default NULL,
access_time time default NULL,
approved datetime default NULL,
UNIQUE KEY users_id_index_idx (user_id)
);
Actual result:
--------------
name: user_name
max_length: 0
length: 12
type: 254
name: user_password
max_length: 0
length: 65535
type: 252
name: subscribed
max_length: 0
length: 4
type: 1
name: user_id
max_length: 0
length: 11
type: 3
name: quota
max_length: 0
length: 20
type: 246
name: weight
max_length: 0
length: 22
type: 5
name: access_date
max_length: 0
length: 10
type: 10
name: access_time
max_length: 0
length: 8
type: 11
name: approved
max_length: 0
length: 19
type: 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36579&edit=1