#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread uw
 ID:   48724
 Updated by:   u...@php.net
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

You are free to patch it. 

Bye.


Previous Comments:


[2009-07-03 16:30:12] an0nym at narod dot ru

Poor MySQLi developers... they've managed to solve this problem without

specification. 

Poor you... you've spent sooo many time for nothing developing this 
function, which works in 35 of 38 cases - this stuff has no 
specification! Wait for a specification - you have a good excuse! 

Bye.



[2009-07-03 16:17:20] u...@php.net

You are free to write a patch. 

I refuse to work on stuff that has no specification and which may go
into any direction. That typically ends up in a backwards compatibility
nightmare, which in particular for an abstraction like PDO makes no
sense to me.

The patch may be rather simple. But watch out for different values
returned by different MySQL versions.



[2009-07-03 15:39:20] an0nym at narod dot ru

> libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug. 
I agree. This is not a libmysql or mysqlnd bug. This is a PDO (or 
PDO_MySQL) bug.



[2009-07-03 15:31:27] an0nym at narod dot ru

Tell me then, why MySQLi is OK with all the types while PDO is not? 
Nevertheless, it is not just OK, but it is EQUAL in behaviour for all 
the types except TINYINT, BIT and YEAR. 

Don't tell me, please, MySQLi type and PDO native type refer to 
different things. I'm almost sure they don't. At least they shouldn't.


exec("CREATE TABLE `test`(
 `tinyint` TINYINT NOT NULL
,`smallint` SMALLINT NOT NULL
,`mediumint` MEDIUMINT NOT NULL
,`int` INT NOT NULL
,`bigint` BIGINT NOT NULL
,`decimal` DECIMAL NOT NULL
,`float` FLOAT NOT NULL
,`double` DOUBLE NOT NULL
,`bit` BIT(1) NOT NULL
,`date` DATE NOT NULL
,`datetime` DATETIME NOT NULL
,`timestamp` TIMESTAMP NOT NULL
,`time` TIME NOT NULL
,`year` YEAR NOT NULL
,`char` CHAR(1) NOT NULL
,`varchar` VARCHAR(1) NOT NULL
,`tinytext` TINYTEXT NOT NULL
,`text` TEXT NOT NULL
,`mediumtext` MEDIUMTEXT NOT NULL
,`longtext` LONGTEXT NOT NULL
,`binary` BINARY(1) NOT NULL
,`varbinary` VARBINARY(1) NOT NULL
,`tinyblob` TINYBLOB NOT NULL
,`mediumblob` MEDIUMBLOB NOT NULL
,`blob` BLOB NOT NULL
,`longblob` LONGBLOB NOT NULL
,`enum` ENUM('') NOT NULL
,`set` SET('') NOT NULL)");
$PDO->exec('INSERT INTO `test`(`tinyint`) VALUES(0)');
$PDO_statement=$PDO->query('SELECT * FROM `test`');
$PDO_fields=array();
for($i=0,$n=$PDO_statement->columnCount();$i<$n;++$i){
$PDO_fields[]=$PDO_statement->getColumnMeta($i);
}
$MySQLi=new mysqli('localhost','anyone','anyone','test');
$MySQLi_result=$MySQLi->query('SELECT * FROM `test`');
$MySQLi_fields=$MySQLi_result->fetch_fields();
$bug_fields=array();
for($i=0,$n=count($PDO_fields);$i<$n;++$i){
if(!isset($PDO_fields[$i]['native_type'])
 or 
constant('MYSQLI_TYPE_'.$PDO_fields[$i]['native_type'])!=$MySQLi_field
s[$i]->type){
$bug_fields[]=$PDO_fields[$i]['name'];
}
}
var_dump($bug_fields);
$PDO->exec('DROP TABLE `test`'); ?>



[2009-07-03 14:29:33] u...@php.net

According to the test behaviour is not to set for certain types. This
is what you get.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/48724

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



#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread an0nym at narod dot ru
 ID:   48724
 User updated by:  an0nym at narod dot ru
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

Poor MySQLi developers... they've managed to solve this problem without

specification. 

Poor you... you've spent sooo many time for nothing developing this 
function, which works in 35 of 38 cases - this stuff has no 
specification! Wait for a specification - you have a good excuse! 

Bye.


Previous Comments:


[2009-07-03 16:17:20] u...@php.net

You are free to write a patch. 

I refuse to work on stuff that has no specification and which may go
into any direction. That typically ends up in a backwards compatibility
nightmare, which in particular for an abstraction like PDO makes no
sense to me.

The patch may be rather simple. But watch out for different values
returned by different MySQL versions.



[2009-07-03 15:39:20] an0nym at narod dot ru

> libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug. 
I agree. This is not a libmysql or mysqlnd bug. This is a PDO (or 
PDO_MySQL) bug.



[2009-07-03 15:31:27] an0nym at narod dot ru

Tell me then, why MySQLi is OK with all the types while PDO is not? 
Nevertheless, it is not just OK, but it is EQUAL in behaviour for all 
the types except TINYINT, BIT and YEAR. 

Don't tell me, please, MySQLi type and PDO native type refer to 
different things. I'm almost sure they don't. At least they shouldn't.


exec("CREATE TABLE `test`(
 `tinyint` TINYINT NOT NULL
,`smallint` SMALLINT NOT NULL
,`mediumint` MEDIUMINT NOT NULL
,`int` INT NOT NULL
,`bigint` BIGINT NOT NULL
,`decimal` DECIMAL NOT NULL
,`float` FLOAT NOT NULL
,`double` DOUBLE NOT NULL
,`bit` BIT(1) NOT NULL
,`date` DATE NOT NULL
,`datetime` DATETIME NOT NULL
,`timestamp` TIMESTAMP NOT NULL
,`time` TIME NOT NULL
,`year` YEAR NOT NULL
,`char` CHAR(1) NOT NULL
,`varchar` VARCHAR(1) NOT NULL
,`tinytext` TINYTEXT NOT NULL
,`text` TEXT NOT NULL
,`mediumtext` MEDIUMTEXT NOT NULL
,`longtext` LONGTEXT NOT NULL
,`binary` BINARY(1) NOT NULL
,`varbinary` VARBINARY(1) NOT NULL
,`tinyblob` TINYBLOB NOT NULL
,`mediumblob` MEDIUMBLOB NOT NULL
,`blob` BLOB NOT NULL
,`longblob` LONGBLOB NOT NULL
,`enum` ENUM('') NOT NULL
,`set` SET('') NOT NULL)");
$PDO->exec('INSERT INTO `test`(`tinyint`) VALUES(0)');
$PDO_statement=$PDO->query('SELECT * FROM `test`');
$PDO_fields=array();
for($i=0,$n=$PDO_statement->columnCount();$i<$n;++$i){
$PDO_fields[]=$PDO_statement->getColumnMeta($i);
}
$MySQLi=new mysqli('localhost','anyone','anyone','test');
$MySQLi_result=$MySQLi->query('SELECT * FROM `test`');
$MySQLi_fields=$MySQLi_result->fetch_fields();
$bug_fields=array();
for($i=0,$n=count($PDO_fields);$i<$n;++$i){
if(!isset($PDO_fields[$i]['native_type'])
 or 
constant('MYSQLI_TYPE_'.$PDO_fields[$i]['native_type'])!=$MySQLi_field
s[$i]->type){
$bug_fields[]=$PDO_fields[$i]['name'];
}
}
var_dump($bug_fields);
$PDO->exec('DROP TABLE `test`'); ?>



[2009-07-03 14:29:33] u...@php.net

According to the test behaviour is not to set for certain types. This
is what you get.



[2009-07-03 14:28:26] u...@php.net

libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug.







 libmysql ---

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.35

pdo_sqlite
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config'

nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}


-- mysqlnd 

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | g

#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread uw
 ID:   48724
 Updated by:   u...@php.net
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

You are free to write a patch. 

I refuse to work on stuff that has no specification and which may go
into any direction. That typically ends up in a backwards compatibility
nightmare, which in particular for an abstraction like PDO makes no
sense to me.

The patch may be rather simple. But watch out for different values
returned by different MySQL versions.


Previous Comments:


[2009-07-03 15:39:20] an0nym at narod dot ru

> libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug. 
I agree. This is not a libmysql or mysqlnd bug. This is a PDO (or 
PDO_MySQL) bug.



[2009-07-03 15:31:27] an0nym at narod dot ru

Tell me then, why MySQLi is OK with all the types while PDO is not? 
Nevertheless, it is not just OK, but it is EQUAL in behaviour for all 
the types except TINYINT, BIT and YEAR. 

Don't tell me, please, MySQLi type and PDO native type refer to 
different things. I'm almost sure they don't. At least they shouldn't.


exec("CREATE TABLE `test`(
 `tinyint` TINYINT NOT NULL
,`smallint` SMALLINT NOT NULL
,`mediumint` MEDIUMINT NOT NULL
,`int` INT NOT NULL
,`bigint` BIGINT NOT NULL
,`decimal` DECIMAL NOT NULL
,`float` FLOAT NOT NULL
,`double` DOUBLE NOT NULL
,`bit` BIT(1) NOT NULL
,`date` DATE NOT NULL
,`datetime` DATETIME NOT NULL
,`timestamp` TIMESTAMP NOT NULL
,`time` TIME NOT NULL
,`year` YEAR NOT NULL
,`char` CHAR(1) NOT NULL
,`varchar` VARCHAR(1) NOT NULL
,`tinytext` TINYTEXT NOT NULL
,`text` TEXT NOT NULL
,`mediumtext` MEDIUMTEXT NOT NULL
,`longtext` LONGTEXT NOT NULL
,`binary` BINARY(1) NOT NULL
,`varbinary` VARBINARY(1) NOT NULL
,`tinyblob` TINYBLOB NOT NULL
,`mediumblob` MEDIUMBLOB NOT NULL
,`blob` BLOB NOT NULL
,`longblob` LONGBLOB NOT NULL
,`enum` ENUM('') NOT NULL
,`set` SET('') NOT NULL)");
$PDO->exec('INSERT INTO `test`(`tinyint`) VALUES(0)');
$PDO_statement=$PDO->query('SELECT * FROM `test`');
$PDO_fields=array();
for($i=0,$n=$PDO_statement->columnCount();$i<$n;++$i){
$PDO_fields[]=$PDO_statement->getColumnMeta($i);
}
$MySQLi=new mysqli('localhost','anyone','anyone','test');
$MySQLi_result=$MySQLi->query('SELECT * FROM `test`');
$MySQLi_fields=$MySQLi_result->fetch_fields();
$bug_fields=array();
for($i=0,$n=count($PDO_fields);$i<$n;++$i){
if(!isset($PDO_fields[$i]['native_type'])
 or 
constant('MYSQLI_TYPE_'.$PDO_fields[$i]['native_type'])!=$MySQLi_field
s[$i]->type){
$bug_fields[]=$PDO_fields[$i]['name'];
}
}
var_dump($bug_fields);
$PDO->exec('DROP TABLE `test`'); ?>



[2009-07-03 14:29:33] u...@php.net

According to the test behaviour is not to set for certain types. This
is what you get.



[2009-07-03 14:28:26] u...@php.net

libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug.







 libmysql ---

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.35

pdo_sqlite
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config'

nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}


-- mysqlnd 

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure'  '--with-pdo-mysql=mysqlnd'
'--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-debug'
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27
$
Persistent cache 

#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread an0nym at narod dot ru
 ID:   48724
 User updated by:  an0nym at narod dot ru
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

> libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug. 
I agree. This is not a libmysql or mysqlnd bug. This is a PDO (or 
PDO_MySQL) bug.


Previous Comments:


[2009-07-03 15:31:27] an0nym at narod dot ru

Tell me then, why MySQLi is OK with all the types while PDO is not? 
Nevertheless, it is not just OK, but it is EQUAL in behaviour for all 
the types except TINYINT, BIT and YEAR. 

Don't tell me, please, MySQLi type and PDO native type refer to 
different things. I'm almost sure they don't. At least they shouldn't.


exec("CREATE TABLE `test`(
 `tinyint` TINYINT NOT NULL
,`smallint` SMALLINT NOT NULL
,`mediumint` MEDIUMINT NOT NULL
,`int` INT NOT NULL
,`bigint` BIGINT NOT NULL
,`decimal` DECIMAL NOT NULL
,`float` FLOAT NOT NULL
,`double` DOUBLE NOT NULL
,`bit` BIT(1) NOT NULL
,`date` DATE NOT NULL
,`datetime` DATETIME NOT NULL
,`timestamp` TIMESTAMP NOT NULL
,`time` TIME NOT NULL
,`year` YEAR NOT NULL
,`char` CHAR(1) NOT NULL
,`varchar` VARCHAR(1) NOT NULL
,`tinytext` TINYTEXT NOT NULL
,`text` TEXT NOT NULL
,`mediumtext` MEDIUMTEXT NOT NULL
,`longtext` LONGTEXT NOT NULL
,`binary` BINARY(1) NOT NULL
,`varbinary` VARBINARY(1) NOT NULL
,`tinyblob` TINYBLOB NOT NULL
,`mediumblob` MEDIUMBLOB NOT NULL
,`blob` BLOB NOT NULL
,`longblob` LONGBLOB NOT NULL
,`enum` ENUM('') NOT NULL
,`set` SET('') NOT NULL)");
$PDO->exec('INSERT INTO `test`(`tinyint`) VALUES(0)');
$PDO_statement=$PDO->query('SELECT * FROM `test`');
$PDO_fields=array();
for($i=0,$n=$PDO_statement->columnCount();$i<$n;++$i){
$PDO_fields[]=$PDO_statement->getColumnMeta($i);
}
$MySQLi=new mysqli('localhost','anyone','anyone','test');
$MySQLi_result=$MySQLi->query('SELECT * FROM `test`');
$MySQLi_fields=$MySQLi_result->fetch_fields();
$bug_fields=array();
for($i=0,$n=count($PDO_fields);$i<$n;++$i){
if(!isset($PDO_fields[$i]['native_type'])
 or 
constant('MYSQLI_TYPE_'.$PDO_fields[$i]['native_type'])!=$MySQLi_field
s[$i]->type){
$bug_fields[]=$PDO_fields[$i]['name'];
}
}
var_dump($bug_fields);
$PDO->exec('DROP TABLE `test`'); ?>



[2009-07-03 14:29:33] u...@php.net

According to the test behaviour is not to set for certain types. This
is what you get.



[2009-07-03 14:28:26] u...@php.net

libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug.







 libmysql ---

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.35

pdo_sqlite
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config'

nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}


-- mysqlnd 

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure'  '--with-pdo-mysql=mysqlnd'
'--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-debug'
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27
$
Persistent cache => enabled
put_hits => 0
--
size => 2000
free_items => 2000
references => 2

Directive => Local Value => Master Value
pdo_mysql.cache_size => 2000 => 2000
pdo_mysql.debug => no value => no value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.6.16
nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELEC

#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread an0nym at narod dot ru
 ID:   48724
 User updated by:  an0nym at narod dot ru
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

Tell me then, why MySQLi is OK with all the types while PDO is not? 
Nevertheless, it is not just OK, but it is EQUAL in behaviour for all 
the types except TINYINT, BIT and YEAR. 

Don't tell me, please, MySQLi type and PDO native type refer to 
different things. I'm almost sure they don't. At least they shouldn't.


exec("CREATE TABLE `test`(
 `tinyint` TINYINT NOT NULL
,`smallint` SMALLINT NOT NULL
,`mediumint` MEDIUMINT NOT NULL
,`int` INT NOT NULL
,`bigint` BIGINT NOT NULL
,`decimal` DECIMAL NOT NULL
,`float` FLOAT NOT NULL
,`double` DOUBLE NOT NULL
,`bit` BIT(1) NOT NULL
,`date` DATE NOT NULL
,`datetime` DATETIME NOT NULL
,`timestamp` TIMESTAMP NOT NULL
,`time` TIME NOT NULL
,`year` YEAR NOT NULL
,`char` CHAR(1) NOT NULL
,`varchar` VARCHAR(1) NOT NULL
,`tinytext` TINYTEXT NOT NULL
,`text` TEXT NOT NULL
,`mediumtext` MEDIUMTEXT NOT NULL
,`longtext` LONGTEXT NOT NULL
,`binary` BINARY(1) NOT NULL
,`varbinary` VARBINARY(1) NOT NULL
,`tinyblob` TINYBLOB NOT NULL
,`mediumblob` MEDIUMBLOB NOT NULL
,`blob` BLOB NOT NULL
,`longblob` LONGBLOB NOT NULL
,`enum` ENUM('') NOT NULL
,`set` SET('') NOT NULL)");
$PDO->exec('INSERT INTO `test`(`tinyint`) VALUES(0)');
$PDO_statement=$PDO->query('SELECT * FROM `test`');
$PDO_fields=array();
for($i=0,$n=$PDO_statement->columnCount();$i<$n;++$i){
$PDO_fields[]=$PDO_statement->getColumnMeta($i);
}
$MySQLi=new mysqli('localhost','anyone','anyone','test');
$MySQLi_result=$MySQLi->query('SELECT * FROM `test`');
$MySQLi_fields=$MySQLi_result->fetch_fields();
$bug_fields=array();
for($i=0,$n=count($PDO_fields);$i<$n;++$i){
if(!isset($PDO_fields[$i]['native_type'])
 or 
constant('MYSQLI_TYPE_'.$PDO_fields[$i]['native_type'])!=$MySQLi_field
s[$i]->type){
$bug_fields[]=$PDO_fields[$i]['name'];
}
}
var_dump($bug_fields);
$PDO->exec('DROP TABLE `test`'); ?>


Previous Comments:


[2009-07-03 14:29:33] u...@php.net

According to the test behaviour is not to set for certain types. This
is what you get.



[2009-07-03 14:28:26] u...@php.net

libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug.







 libmysql ---

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.35

pdo_sqlite
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config'

nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}


-- mysqlnd 

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure'  '--with-pdo-mysql=mysqlnd'
'--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-debug'
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27
$
Persistent cache => enabled
put_hits => 0
--
size => 2000
free_items => 2000
references => 2

Directive => Local Value => Master Value
pdo_mysql.cache_size => 2000 => 2000
pdo_mysql.debug => no value => no value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.6.16
nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6

#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread uw
 ID:   48724
 Updated by:   u...@php.net
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

According to the test behaviour is not to set for certain types. This
is what you get.


Previous Comments:


[2009-07-03 14:28:26] u...@php.net

libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug.







 libmysql ---

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.35

pdo_sqlite
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config'

nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}


-- mysqlnd 

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure'  '--with-pdo-mysql=mysqlnd'
'--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-debug'
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27
$
Persistent cache => enabled
put_hits => 0
--
size => 2000
free_items => 2000
references => 2

Directive => Local Value => Master Value
pdo_mysql.cache_size => 2000 => 2000
pdo_mysql.debug => no value => no value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.6.16
nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}





[2009-07-03 14:13:41] an0nym at narod dot ru

If function has expected behaviour for 35 of 38 cases (that's how many

different types has MySQL), it is rather clear how should it behave for

remaining 3. 

> How can there be a bug if behaviour is undefined? 
Behaviour is not undefined. According to the link you provided, 
behaviour can be changed without notice, but on the moment of writing
it 
is surely defined and has a bug.



[2009-07-03 13:27:23] u...@php.net

Warning

This function is EXPERIMENTAL. The behaviour of this function, its
name, and surrounding documentation may change without notice in a
future release of PHP. This function should be used at your own risk. 

http://de2.php.net/manual/en/pdostatement.getcolumnmeta.php

How can there be a bug if behaviour is undefined?



[2009-06-30 15:33:29] an0nym at narod dot ru

Tested - this bug remains actual with PHP 5.3.0 and mysqlnd.



[2009-06-29 18:02:58] an0nym at narod dot ru

Description:

PDOStatement::getColumnMeta() doesn't return native_type for BIT, 
TINYINT and YEAR type columns (these should be 'BIT', 'TINY' and 'YEAR'

respectively). 

This bug was partly discussed within bug #46533, but that bug is 
generally about another thing. 

Reproduce code:
---
$DB=new PDO('mysql:host=localhost;dbname=test','anyone','anyone');
$DB->exec('CREATE TABLE `test`(
 `bit` bit(1)
,`tinyint` tinyint
,`year` year)');
$DB->exec('INSERT INTO `test` VALUES(1,1,2000)');
$statement=$DB->query('SELECT `bit`,`tinyint`,`year` FROM `test`');
$bit=$statement->getColumnMeta(0);
$tinyint=$statement->getColumnMeta(1);
$year=$statement->getColumnMeta(2);
var_dump(isset($bit['native_type']),isset($tinyint['native_type']),isset($year['native_type']));

Expected result:

bool(true) bool(true) bool(true)

Actual result:
--
boo

#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread uw
 ID:   48724
 Updated by:   u...@php.net
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

libmysql and mysqlnd behave the same way. If this is decided to be
considered as a bug it is not a mysqlnd bug.







 libmysql ---

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.35

pdo_sqlite
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config'

nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}


-- mysqlnd 

nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep configure
Configure Command =>  './configure'  '--with-pdo-mysql=mysqlnd'
'--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-debug'
nixn...@ulflinux:~/src/login/php5> sapi/cli/php -i | grep -C5
pdo_mysql
PDO

PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27
$
Persistent cache => enabled
put_hits => 0
--
size => 2000
free_items => 2000
references => 2

Directive => Local Value => Master Value
pdo_mysql.cache_size => 2000 => 2000
pdo_mysql.debug => no value => no value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.6.16
nixn...@ulflinux:~/src/login/php5> sapi/cli/php pdo.php

int(0)
int(0)
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(36) "SELECT cbit,ctinyint,cyear FROM test"
}
array(6) {
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(5) "cyear"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(0)
}
bool(false)
bool(false)
bool(false)
array(1) {
  [0]=>
  array(2) {
["VERSION()"]=>
string(6) "5.1.35"
[0]=>
string(6) "5.1.35"
  }
}




Previous Comments:


[2009-07-03 14:13:41] an0nym at narod dot ru

If function has expected behaviour for 35 of 38 cases (that's how many

different types has MySQL), it is rather clear how should it behave for

remaining 3. 

> How can there be a bug if behaviour is undefined? 
Behaviour is not undefined. According to the link you provided, 
behaviour can be changed without notice, but on the moment of writing
it 
is surely defined and has a bug.



[2009-07-03 13:27:23] u...@php.net

Warning

This function is EXPERIMENTAL. The behaviour of this function, its
name, and surrounding documentation may change without notice in a
future release of PHP. This function should be used at your own risk. 

http://de2.php.net/manual/en/pdostatement.getcolumnmeta.php

How can there be a bug if behaviour is undefined?



[2009-06-30 15:33:29] an0nym at narod dot ru

Tested - this bug remains actual with PHP 5.3.0 and mysqlnd.



[2009-06-29 18:02:58] an0nym at narod dot ru

Description:

PDOStatement::getColumnMeta() doesn't return native_type for BIT, 
TINYINT and YEAR type columns (these should be 'BIT', 'TINY' and 'YEAR'

respectively). 

This bug was partly discussed within bug #46533, but that bug is 
generally about another thing. 

Reproduce code:
---
$DB=new PDO('mysql:host=localhost;dbname=test','anyone','anyone');
$DB->exec('CREATE TABLE `test`(
 `bit` bit(1)
,`tinyint` tinyint
,`year` year)');
$DB->exec('INSERT INTO `test` VALUES(1,1,2000)');
$statement=$DB->query('SELECT `bit`,`tinyint`,`year` FROM `test`');
$bit=$statement->getColumnMeta(0);
$tinyint=$statement->getColumnMeta(1);
$year=$statement->getColumnMeta(2);
var_dump(isset($bit['native_type']),isset($tinyint['native_type']),isset($year['native_type']));

Expected result:

bool(true) bool(true) bool(true)

Actual result:
--
bool(false) bool(false) bool(false)





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



#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread an0nym at narod dot ru
 ID:   48724
 User updated by:  an0nym at narod dot ru
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

If function has expected behaviour for 35 of 38 cases (that's how many

different types has MySQL), it is rather clear how should it behave for

remaining 3. 

> How can there be a bug if behaviour is undefined? 
Behaviour is not undefined. According to the link you provided, 
behaviour can be changed without notice, but on the moment of writing
it 
is surely defined and has a bug.


Previous Comments:


[2009-07-03 13:27:23] u...@php.net

Warning

This function is EXPERIMENTAL. The behaviour of this function, its
name, and surrounding documentation may change without notice in a
future release of PHP. This function should be used at your own risk. 

http://de2.php.net/manual/en/pdostatement.getcolumnmeta.php

How can there be a bug if behaviour is undefined?



[2009-06-30 15:33:29] an0nym at narod dot ru

Tested - this bug remains actual with PHP 5.3.0 and mysqlnd.



[2009-06-29 18:02:58] an0nym at narod dot ru

Description:

PDOStatement::getColumnMeta() doesn't return native_type for BIT, 
TINYINT and YEAR type columns (these should be 'BIT', 'TINY' and 'YEAR'

respectively). 

This bug was partly discussed within bug #46533, but that bug is 
generally about another thing. 

Reproduce code:
---
$DB=new PDO('mysql:host=localhost;dbname=test','anyone','anyone');
$DB->exec('CREATE TABLE `test`(
 `bit` bit(1)
,`tinyint` tinyint
,`year` year)');
$DB->exec('INSERT INTO `test` VALUES(1,1,2000)');
$statement=$DB->query('SELECT `bit`,`tinyint`,`year` FROM `test`');
$bit=$statement->getColumnMeta(0);
$tinyint=$statement->getColumnMeta(1);
$year=$statement->getColumnMeta(2);
var_dump(isset($bit['native_type']),isset($tinyint['native_type']),isset($year['native_type']));

Expected result:

bool(true) bool(true) bool(true)

Actual result:
--
bool(false) bool(false) bool(false)





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



#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-07-03 Thread uw
 ID:   48724
 Updated by:   u...@php.net
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
 PHP Version:  5.3.0
 New Comment:

Warning

This function is EXPERIMENTAL. The behaviour of this function, its
name, and surrounding documentation may change without notice in a
future release of PHP. This function should be used at your own risk. 

http://de2.php.net/manual/en/pdostatement.getcolumnmeta.php

How can there be a bug if behaviour is undefined?


Previous Comments:


[2009-06-30 15:33:29] an0nym at narod dot ru

Tested - this bug remains actual with PHP 5.3.0 and mysqlnd.



[2009-06-29 18:02:58] an0nym at narod dot ru

Description:

PDOStatement::getColumnMeta() doesn't return native_type for BIT, 
TINYINT and YEAR type columns (these should be 'BIT', 'TINY' and 'YEAR'

respectively). 

This bug was partly discussed within bug #46533, but that bug is 
generally about another thing. 

Reproduce code:
---
$DB=new PDO('mysql:host=localhost;dbname=test','anyone','anyone');
$DB->exec('CREATE TABLE `test`(
 `bit` bit(1)
,`tinyint` tinyint
,`year` year)');
$DB->exec('INSERT INTO `test` VALUES(1,1,2000)');
$statement=$DB->query('SELECT `bit`,`tinyint`,`year` FROM `test`');
$bit=$statement->getColumnMeta(0);
$tinyint=$statement->getColumnMeta(1);
$year=$statement->getColumnMeta(2);
var_dump(isset($bit['native_type']),isset($tinyint['native_type']),isset($year['native_type']));

Expected result:

bool(true) bool(true) bool(true)

Actual result:
--
bool(false) bool(false) bool(false)





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



#48724 [Opn]: getColumnMeta() doesn't return native_type for BIT, TINYINT and YEAR

2009-06-30 Thread an0nym at narod dot ru
 ID:   48724
 User updated by:  an0nym at narod dot ru
 Reported By:  an0nym at narod dot ru
 Status:   Open
 Bug Type: PDO related
 Operating System: *
-PHP Version:  5.2.10
+PHP Version:  5.3.0
 New Comment:

Tested - this bug remains actual with PHP 5.3.0 and mysqlnd.


Previous Comments:


[2009-06-29 18:02:58] an0nym at narod dot ru

Description:

PDOStatement::getColumnMeta() doesn't return native_type for BIT, 
TINYINT and YEAR type columns (these should be 'BIT', 'TINY' and 'YEAR'

respectively). 

This bug was partly discussed within bug #46533, but that bug is 
generally about another thing. 

Reproduce code:
---
$DB=new PDO('mysql:host=localhost;dbname=test','anyone','anyone');
$DB->exec('CREATE TABLE `test`(
 `bit` bit(1)
,`tinyint` tinyint
,`year` year)');
$DB->exec('INSERT INTO `test` VALUES(1,1,2000)');
$statement=$DB->query('SELECT `bit`,`tinyint`,`year` FROM `test`');
$bit=$statement->getColumnMeta(0);
$tinyint=$statement->getColumnMeta(1);
$year=$statement->getColumnMeta(2);
var_dump(isset($bit['native_type']),isset($tinyint['native_type']),isset($year['native_type']));

Expected result:

bool(true) bool(true) bool(true)

Actual result:
--
bool(false) bool(false) bool(false)





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