note 93159 added to mysqli-result.fetch-field-direct
| From: | shoresofnowhere at gmail dot com | Date: | Wed, 26 Aug 2009 10:50:31 +0000 |
| Subject: | note 93159 added to mysqli-result.fetch-field-direct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159898@lists.php.net to get a copy of this message | ||
Beware of the fact that the ->def property NEVER gets filled with the correct default field
value, so it's totally USELESS.
This happens NOT for a bug in php (so don't go filling in a bug report), but happens BY DESIGN,
since the MySQL C API call doesn't fill in this value, unless you call the mysql_list_fields()
function, which Php doesn't.
See here for reference.
http://dev.mysql.com/doc/refman/5.0/en/c-api-datatypes.html
Also, be aware that if you're using a query which contains subqueries, the primary
key/autoincrement flags do NOT get passed along, even if the field you're looking at is the
primary autoincrement key of the master table:
SELECT * from (SELECT id from areas) AS subareas
and you'll find primary key and autoinc flags off on id field, even if id was the primary
autoinc key of areas table.
This also is by design, i think, since it's supposed that if we're using a subquery then
the primary key/autoinc stuff might have no sense at all, since in the result set we can compose
fileds from many different tables.
Hoping this is useful, bye!
----
Server IP: 69.147.83.197
Probable Submitter: 93.42.58.43
----
Manual Page -- http://www.php.net/manual/en/mysqli-result.fetch-field-direct.php
Edit -- https://master.php.net/note/edit/93159
Del: integrated -- https://master.php.net/note/delete/93159/integrated
Del: useless -- https://master.php.net/note/delete/93159/useless
Del: bad code -- https://master.php.net/note/delete/93159/bad+code
Del: spam -- https://master.php.net/note/delete/93159/spam
Del: non-english -- https://master.php.net/note/delete/93159/non-english
Del: in docs -- https://master.php.net/note/delete/93159/in+docs
Del: other reasons-- https://master.php.net/note/delete/93159
Reject -- https://master.php.net/note/reject/93159
Search -- https://master.php.net/manage/user-notes.php