#31979 [Opn->Bgs]: msql_fetch_field() not reporting unique keys

From: Date: Mon, 06 Jun 2005 22:24:33 +0000
Subject: #31979 [Opn->Bgs]: msql_fetch_field() not reporting unique keys
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79979@lists.php.net to get a copy of this message
 ID:               31979
 Updated by:       sniper@php.net
 Reported By:      danielc at analysisandsolutions dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         mSQL related
 Operating System: NetBSD 2.0
 PHP Version:      5CVS-2005-02-15
 New Comment:

Apparently the msql version you've compiled PHP does not set the field
properly.



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

[2005-02-15 05:26:25] danielc at analysisandsolutions dot com

Description:
------------
One of the properties returned by msql_fetch_field() is "unique".  It
is supposed to contain 1 if the column in question is part of a unique
key and 0 if it's not.  But it always returns 0.

Reproduce code:
---------------
$con = msql_connect();
$db  = msql_select_db('ptdb', $con);
msql_query('CREATE TABLE blah (i INT)', $con);
msql_query('CREATE UNIQUE INDEX bi ON blah (i)', $con);
$result = msql_query('SELECT * FROM blah', $con);
$info = msql_fetch_field($result);
print_r($info);
msql_query('DROP TABLE blah', $con);

Expected result:
----------------
stdClass Object
(
    [name] => i
    [table] => blah
    [not_null] => 0
    [unique] => 1
    [type] => int
)

Actual result:
--------------
stdClass Object
(
    [name] => i
    [table] => blah
    [not_null] => 0
    [unique] => 0
    [type] => int
)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31979&edit=1


Thread (5 messages)

« previous php.bugs (#79979) next »