FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179349] Fri, 12 October 2012 11:02 Go to next message
Jabber is currently offline  Jabber
Messages: 6
Registered: October 2012
Karma: 0
Junior Member
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?
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179351 is a reply to message #179349] Fri, 12 October 2012 12:38 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 12.10.2012 13:02, schrieb Jabber:
> 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?
>

Why don't you just do a var_dump() of id, and echo the constants you are using? I
can't test, I'm only using postgresql.

The result of a function always depends on the input...

/Str.
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179354 is a reply to message #179351] Fri, 12 October 2012 13:38 Go to previous messageGo to next message
Jabber is currently offline  Jabber
Messages: 6
Registered: October 2012
Karma: 0
Junior Member
This is the dumping of "id" field:

Object (
name = String(2) "id"
orgname = String(2) "id"
table = String(4) "item"
orgtable = String(4) "item"
def = String(0) ""
db = String(4) "gpro"
catalog = String(3) "def"
max_length = Integer(1) 4
length = Integer(2) 10
charsetnr = Integer(1) 8
flags = Integer(5) 20489
type = Integer(3) 253
decimals = Integer(1) 0
)

I use only previuos tow constants.

PS:
What php library do you use to interface postgresql server ?
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179358 is a reply to message #179351] Fri, 12 October 2012 14:55 Go to previous messageGo to next message
Jabber is currently offline  Jabber
Messages: 6
Registered: October 2012
Karma: 0
Junior Member
Here is var_dump of "id" field:

Object (
| name = String(2) "id"
| orgname = String(2) "id"
| table = String(4) "info_table"
| orgtable = String(4) "info_table"
| def = String(0) ""
| db = String(4) "gpro"
| catalog = String(3) "def"
| max_length = Integer(1) 2
| length = Integer(1) 4
| charsetnr = Integer(2) 63
| flags = Integer(5) 49667
| type = Integer(1) 2
| decimals = Integer(1) 0
)

I've tried all mysqli flag constants (see http://php.net/manual/en/mysqli.constants.php) by bitwise operator ( $id & CONSTANT ),
these are the flag constants returned not zero:
MYSQLI_NOT_NULL_FLAG
MYSQLI_PRI_KEY_FLAG
MYSQLI_AUTO_INCREMENT_FLAG
MYSQLI_PART_KEY_FLAG
MYSQLI_NUM_FLAG
MYSQLI_GROUP_FLAG

"id" fields of smallint type.

PS:
what type of php lib do you use to intercafe postgresql server?
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179359 is a reply to message #179351] Fri, 12 October 2012 14:57 Go to previous messageGo to next message
Jabber is currently offline  Jabber
Messages: 6
Registered: October 2012
Karma: 0
Junior Member
Here is var_dump of "id" field:

Object (
| name = String(2) "id"
| orgname = String(2) "id"
| table = String(4) "info_table"
| orgtable = String(4) "info_table"
| def = String(0) ""
| db = String(4) "gpro"
| catalog = String(3) "def"
| max_length = Integer(1) 2
| length = Integer(1) 4
| charsetnr = Integer(2) 63
| flags = Integer(5) 49667
| type = Integer(1) 2
| decimals = Integer(1) 0
)

I've tried all mysqli flag constants (see http://php.net/manual/en/mysqli.constants.php) by bitwise operator ( $id & CONSTANT ),
these are the flag constants returned not zero:
MYSQLI_NOT_NULL_FLAG
MYSQLI_PRI_KEY_FLAG
MYSQLI_AUTO_INCREMENT_FLAG
MYSQLI_PART_KEY_FLAG
MYSQLI_NUM_FLAG
MYSQLI_GROUP_FLAG

"id" field is of smallint type.


PS:
what type of php lib do you use to intercafe postgresql server?
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179360 is a reply to message #179351] Fri, 12 October 2012 14:59 Go to previous messageGo to next message
Jabber is currently offline  Jabber
Messages: 6
Registered: October 2012
Karma: 0
Junior Member
Here is var_dump of "id" field:

Object (
| name = String(2) "id"
| orgname = String(2) "id"
| table = String(4) "info_table"
| orgtable = String(4) "info_table"
| def = String(0) ""
| db = String(4) "gpro"
| catalog = String(3) "def"
| max_length = Integer(1) 2
| length = Integer(1) 4
| charsetnr = Integer(2) 63
| flags = Integer(5) 49667
| type = Integer(1) 2
| decimals = Integer(1) 0
)

I've tried all mysqli flag constants (see http://php.net/manual/en/mysqli.constants.php) by bitwise operator ( $id & CONSTANT ),
these are the flag constants returned not zero:
MYSQLI_NOT_NULL_FLAG
MYSQLI_PRI_KEY_FLAG
MYSQLI_AUTO_INCREMENT_FLAG
MYSQLI_PART_KEY_FLAG
MYSQLI_NUM_FLAG
MYSQLI_GROUP_FLAG

"id" field is of smallint type.

PS:
what type of php lib do you use to intercafe postgresql server?
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179361 is a reply to message #179354] Fri, 12 October 2012 15:12 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 12.10.2012 15:38, schrieb Jabber:
> This is the dumping of "id" field:
>
> Object (
> name = String(2) "id"
> orgname = String(2) "id"
> table = String(4) "item"
> orgtable = String(4) "item"
> def = String(0) ""
> db = String(4) "gpro"
> catalog = String(3) "def"
> max_length = Integer(1) 4
> length = Integer(2) 10
> charsetnr = Integer(1) 8
> flags = Integer(5) 20489
> type = Integer(3) 253
> decimals = Integer(1) 0
> )
>
> I use only previuos tow constants.
>
> PS:
> What php library do you use to interface postgresql server ?
>

I am using PDO, object style.

/Str.
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179363 is a reply to message #179358] Fri, 12 October 2012 15:56 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 12.10.2012 16:55, schrieb Jabber:
> Here is var_dump of "id" field:
>
> Object (
> | name = String(2) "id"
> | orgname = String(2) "id"
> | table = String(4) "info_table"
> | orgtable = String(4) "info_table"
> | def = String(0) ""
> | db = String(4) "gpro"
> | catalog = String(3) "def"
> | max_length = Integer(1) 2
> | length = Integer(1) 4
> | charsetnr = Integer(2) 63
> | flags = Integer(5) 49667
> | type = Integer(1) 2
> | decimals = Integer(1) 0
> )
>
> I've tried all mysqli flag constants (see http://php.net/manual/en/mysqli.constants.php) by bitwise operator ( $id & CONSTANT ),
> these are the flag constants returned not zero:
> MYSQLI_NOT_NULL_FLAG
> MYSQLI_PRI_KEY_FLAG
> MYSQLI_AUTO_INCREMENT_FLAG
> MYSQLI_PART_KEY_FLAG
> MYSQLI_NUM_FLAG
> MYSQLI_GROUP_FLAG
>
> "id" fields of smallint type.

I found out this function maps directly to the C interface and a structure
MYSQL_FIELD I did not find, see
http://dev.mysql.com/doc/refman/5.5/en/mysql-fetch-fields.html

Maybe you find more interpretation in the C docs. So far we know that your findings
are correct.

/Str.
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179364 is a reply to message #179363] Fri, 12 October 2012 16:23 Go to previous messageGo to next message
Jabber is currently offline  Jabber
Messages: 6
Registered: October 2012
Karma: 0
Junior Member
If MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 is it possible it's a php or mysql bug?
I repeat i get MYSQLI_GROUP_FLAG not zero, but "id" field is not a part of a "GROUP BY" clause.

Do you think is it a bug?

J
Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 [message #179366 is a reply to message #179364] Fri, 12 October 2012 21:55 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 12.10.2012 18:23, schrieb Jabber:
> If MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 is it possible it's a php or mysql bug?
> I repeat i get MYSQLI_GROUP_FLAG not zero, but "id" field is not a part of a "GROUP BY" clause.
>
> Do you think is it a bug?
>
> J
>
You are getting exactly the flags you found in posting Fri, 12 Oct 2012 14:55:25
+0000, you can doublecheck by doing printf('binary flag %b',49667) and compare it to
the constants - well, I see it, I gave lots of introductory courses on bits and bytes.

The question is what do the flags really mean.

/Str.
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 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: dll load problem
Next Topic: Curl chmod file transfer problem...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 06:54:33 GMT 2024

Total time taken to generate the page: 0.02501 seconds