Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7281 > unrolled thread

MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768

Started byJabber <jabber2033@interfree.it>
First post2012-10-12 04:02 -0700
Last post2012-10-13 01:47 +0000
Articles 11 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Jabber <jabber2033@interfree.it> - 2012-10-12 04:02 -0700
    Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-10-12 14:38 +0200
      Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Jabber <jabber2033@interfree.it> - 2012-10-12 06:38 -0700
        Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-10-12 17:12 +0200
      Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Jabber <jabber2033@interfree.it> - 2012-10-12 07:55 -0700
        Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-10-12 17:56 +0200
          Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Jabber <jabber2033@interfree.it> - 2012-10-12 09:23 -0700
            Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-10-12 23:55 +0200
      Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Jabber <jabber2033@interfree.it> - 2012-10-12 07:57 -0700
      Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Jabber <jabber2033@interfree.it> - 2012-10-12 07:59 -0700
    Re: MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768 Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-13 01:47 +0000

#7281 — MYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768

FromJabber <jabber2033@interfree.it>
Date2012-10-12 04:02 -0700
SubjectMYSQLI_GROUP_FLAG and MYSQLI_NUM_FLAG are both 32768
Message-ID<09ec6d1f-1a27-43ce-b385-938740b4ae87@googlegroups.com>
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?

[toc] | [next] | [standalone]


#7283

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-10-12 14:38 +0200
Message-ID<adqhadFl0tbU1@mid.uni-berlin.de>
In reply to#7281
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.

[toc] | [prev] | [next] | [standalone]


#7286

FromJabber <jabber2033@interfree.it>
Date2012-10-12 06:38 -0700
Message-ID<59e07f48-2d48-431b-b53d-a12a65f16ff3@googlegroups.com>
In reply to#7283
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 ?

[toc] | [prev] | [next] | [standalone]


#7293

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-10-12 17:12 +0200
Message-ID<adqqamFn413U1@mid.uni-berlin.de>
In reply to#7286
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.

[toc] | [prev] | [next] | [standalone]


#7290

FromJabber <jabber2033@interfree.it>
Date2012-10-12 07:55 -0700
Message-ID<3c21c005-9d9f-49a5-ac2c-54956ea98432@googlegroups.com>
In reply to#7283
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?

[toc] | [prev] | [next] | [standalone]


#7295

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-10-12 17:56 +0200
Message-ID<adqst7FnneqU1@mid.uni-berlin.de>
In reply to#7290
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.

[toc] | [prev] | [next] | [standalone]


#7296

FromJabber <jabber2033@interfree.it>
Date2012-10-12 09:23 -0700
Message-ID<6b87673c-c342-450f-87b2-6d24364086cb@googlegroups.com>
In reply to#7295
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

[toc] | [prev] | [next] | [standalone]


#7298

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-10-12 23:55 +0200
Message-ID<adrhumFsltqU1@mid.uni-berlin.de>
In reply to#7296
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.

[toc] | [prev] | [next] | [standalone]


#7291

FromJabber <jabber2033@interfree.it>
Date2012-10-12 07:57 -0700
Message-ID<df9535bc-c6e5-484e-aa96-713328ae1537@googlegroups.com>
In reply to#7283
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?

[toc] | [prev] | [next] | [standalone]


#7292

FromJabber <jabber2033@interfree.it>
Date2012-10-12 07:59 -0700
Message-ID<e909c50f-d3a4-4c77-9ce7-02d000cdc611@googlegroups.com>
In reply to#7283
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?

[toc] | [prev] | [next] | [standalone]


#7300

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-10-13 01:47 +0000
Message-ID<k5ah77$21v$1@dont-email.me>
In reply to#7281
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web