Doc #60691 [Opn->Fbk]: ->def missing default value
| From: | uw@php.net | Date: | Wed, 02 May 2012 10:13:36 +0000 |
| Subject: | Doc #60691 [Opn->Fbk]: ->def missing default value | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8327@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60691&edit=1
ID: 60691
Updated by: uw@php.net
Reported by: bimal at sanjaal dot com
Summary: ->def missing default value
-Status: Open
+Status: Feedback
Type: Documentation Problem
Package: MySQL related
Operating System: Windows XP
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Please, provide a sample script. That is a short script using mysql_connect, mysql_query and
mysql_fetch_field. Judging from the 5.3 and 5.4 source tree, def is provided since 2004. Its actual
value is taken from the underlying C library which in turn gets it from the server - want to say
that the actual value is server version dependent.
Previous Comments:
------------------------------------------------------------------------
[2012-01-09 10:30:41] bimal at sanjaal dot com
Description:
------------
---
From manual page: http://www.php.net/function.mysql-fetch-field#refsect1-function.mysql-fetch-field-returnvalues
---
http://www.w3schools.com/php/func_mysql_fetch_field.asp
(Purpose: Some reference back to $meta->def)
The field - def - does not contain the default value of the mysql column - even if the default
values were defined in the table.
(PS - The new/upgraded version of PHP manual simply hide this field)
I have used PHP 5.3.5 from XAMPP 1.7 version.
Test script:
---------------
type: $meta->type
default: $meta->def
unique_key: $meta->unique_key
Here, the default value is always missing or returning empty variable.
Expected result:
----------------
Default value assiged to the mysql column while creating it using: DEFAULT 'XXX'.
For example,
is_active enum('N','Y') NOT NULL DEFAULT 'N' COMMENT
'Active record?',
Here, for the field is_active, we should have seen 'N'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60691&edit=1