php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36579 mysqli_fetch_field length handling
Submitted: 2006-03-01 23:33 UTC Modified: 2006-03-02 12:30 UTC
From: lsmith@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.1.2 OS: windows
Private report: No CVE-ID: None
 [2006-03-01 23:33 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-02 01:50 UTC] 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-02 12:30 UTC] bjori@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Jakub Vrana checked in the patch this morning.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC