Doc #51163 [Asn->Csd]: fetch_field variants manual is wrong - they dont provide default value def

From: Date: Wed, 18 Aug 2010 12:36:16 +0000
Subject: Doc #51163 [Asn->Csd]: fetch_field variants manual is wrong - they dont provide default value def
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4882@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51163&edit=1 ID: 51163 Updated by: abedford@php.net Reported by: berniev at bje dot com dot au Summary: fetch_field variants manual is wrong - they dont provide default value def -Status: Assigned +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: ubuntu 9 PHP Version: 5.3.1 Assigned To: abedford Block user comment: N New Comment: I've removed references to the def field as no meaningful value is returned for that field in both mysql and mysqli. If developers later decide to add support for this field I can add details back in. Previous Comments: ------------------------------------------------------------------------ [2010-08-18 14:12:30] abedford@php.net Automatic comment from SVN on behalf of abedford Revision: http://svn.php.net/viewvc/?view=revision&revision=302439 Log: Fixed doc bug #51163. Removed references to def field, as no meaningful value is returned for it. ------------------------------------------------------------------------ [2010-03-01 15:07:33] berniev at bje dot com dot au You are correct in that fetch_field doesn't crash but it always produces empty default column data. Googling shows this is a common problem. Workaround is to use mysql SHOW COLUMNS FROM .. but this is an extra step. shoresofnowhere at gmail dot com 26-Aug-2009 10:50 in http://au2.php.net/mysqli-result.fetch-field-direct suggests it will never produce a result by design and gives what appears a reasonable explanation. I tried examining sources but am not clever enough yet to figure it out. Maybe someone can point me in the right direction. For the benefit of all us noobs please clarify if this is a bug or design. In any event it appears to have been like this for a while and I think this should be reflected in the documentation. Seems to be quite a few of us wasting a lot of time looking for explanation. ------------------------------------------------------------------------ [2010-02-27 23:29:40] niel dot archer at blueyonder dot co dot uk This appears to be a bug, not a documentation problem. I just tried this on PHP 5.3 using the MySQLi extension. $finfo = $result->fetch_field(); echo $finfo->def; Prints an empty string, it does not produce an error for an invalid property. ------------------------------------------------------------------------ [2010-02-27 04:55:19] berniev at bje dot com dot au Description: ------------ The manuals for PHP all show mysql_fetch_field (s) (and mysqli) provide the table default value, WHICH THEY DO NOT! The manuals appear to be blatantly wrong. Interestingly the examples conveniently leave out def values. This may also apply to autoinc and primary key flags? The only reference to this I could find anywhere is a note from shoresofnowhere at gmail dot com 26-Aug-2009 10:50 after hours of searching. Please Please update the manuals!! (or fix php !) Reproduce code: --------------- --- From manual page: http://www.php.net/mysqli-result.fetch-field-direct --- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51163&edit=1

« previous php.doc.bugs (#4882) next »