#42344 [Opn->Fbk]: fetch_field() does not aggregate default value

From: Date: Mon, 20 Aug 2007 09:05:27 +0000
Subject: #42344 [Opn->Fbk]: fetch_field() does not aggregate default value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116342@lists.php.net to get a copy of this message
 ID:               42344
 Updated by:       jani@php.net
 Reported By:      php at michaelho dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Mac OS X 10.4.9
 PHP Version:      5.2.3
 New Comment:

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?


Previous Comments:
------------------------------------------------------------------------

[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


Thread (4 messages)

« previous php.bugs (#116342) next »