Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179368 is a reply to message #179349] |
Sat, 13 October 2012 01:47 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Fri, 12 Oct 2012 04:02:08 -0700, Jabber wrote:
> Hi you all,
>
> i'm using PHP 5.3.10 and Mysql 5.5.2.4, i execute this code: $result =
> $conn->query( $sql ); // $sql is "SELECT * FROM mytable;"
> $headers = $result->fetch_fields();
> $id=$headers[0];
> echo ($id->flags & MYSQLI_NUM_FLAG ); // -> 32768 echo ($id->flags &
> MYSQLI_GROUP_FLAG ); // -> 32768
>
> I get the same number, i.d. 32768, is it a bug ?
> My table id ($headers[0]) is not part of a "GROUP BY" clause.
>
> Do you know somethig about this behavior?
I assume (you didn't say!) that you're using mysqli.
From comments at http://uk.php.net/manual/en/mysqli-result.fetch-
fields.php and http://uk.php.net/manual/en/mysqli-result.fetch-field.php
"The flags used by MySql are:
NOT_NULL_FLAG = 1
PRI_KEY_FLAG = 2
UNIQUE_KEY_FLAG = 4
BLOB_FLAG = 16
UNSIGNED_FLAG = 32
ZEROFILL_FLAG = 64
BINARY_FLAG = 128
ENUM_FLAG = 256
AUTO_INCREMENT_FLAG = 512
TIMESTAMP_FLAG = 1024
SET_FLAG = 2048
NUM_FLAG = 32768
PART_KEY_FLAG = 16384
GROUP_FLAG = 32768
UNIQUE_FLAG = 65536"
You did read the manual, right? So you know that GROUP_FLAG = 32768 and
NUM_FLAG = 32768?
NUM_FLAG is positioned in the list where I would expect the value to be
8192, but I don't know if that's actually significant, as I don't know
where the contributor to the manual got his (or her) information from.
If it is a bug, I don't know if the problem is in mysql or php, because I
don't know if the flag number is generated by php as it processes the
result of the query into an object, or received from mysql as part of the
query result.
Rgds
Denis McMahon
|
|
|