ID: 42344 User updated by: php at michaelho dot com Reported By: php at michaelho dot com Status: Wont fix Bug Type: MySQLi related Operating System: Mac OS X 10.4.9 PHP Version: 5.2.3 New Comment:
Thanks for the note. I suggest that the documentation be updated to reflect this to avoid future confusion. Previous Comments: ------------------------------------------------------------------------ [2007-08-20 13:49:10] [EMAIL PROTECTED] The empty string comes from libmysql, but also mysqlnd doesn't have a solution as the data is not transfered with the meta-data for the columns. A comment in mysqlnd reveals more : char *def; /* Default value (set by mysql_list_fields) */ mysql_list_fields uses COM_FIELD_LIST, from the C/S protocol. Only in this case the default value is sent. If you want to get it, you need to issue SHOW FIELDS FROM or a query against INFORMATION_SCHEMA. ------------------------------------------------------------------------ [2007-08-20 09:05:27] [EMAIL PROTECTED] This is very simple function which just wraps around the provided libmysql function 'mysql_fetch_field' and pretty much can't be a bug on the PHP side. What mysql version have you compiled PHP with? ------------------------------------------------------------------------ [2007-08-20 05:33:30] php at michaelho dot com Description: ------------ The object returned from MySQLi's fetch_field() does not ever aggregate the ->def value. Reproduce code: --------------- (mysql database table definition) CREATE TABLE foo ( some_value VARCHAR(50) DEFAULT 'blah' ); (PHP Code) <?php $mysqli = new mysqli("localhost", "root", "", "test"); $query = "SELECT * from foo"; if ($result = $mysqli->query($query)) { /* Get field information for all columns */ while ($finfo = $result->fetch_field()) { printf("Default Value: %s\n", $finfo->def); } $result->close(); } /* close connection */ $mysqli->close(); ?> Expected result: ---------------- Default Value: blah Actual result: -------------- Default Value: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42344&edit=1