#47224 [Com]: MYSQL_ATTR_INIT_COMMAND is no longer available

2009-07-16 Thread techi at techi dot name
 ID:   47224
 Comment by:   techi at techi dot name
 Reported By:  contact at joycebabu dot com
 Status:   Assigned
 Bug Type: PDO related
 Operating System: Windows
 PHP Version:  5.3.0alpha3
 Assigned To:  mysql
 New Comment:

Using 1002 instead of constant does not work either. Using 5.3.0 under

x64 Windows


Previous Comments:


[2009-07-02 10:43:36] mg at artigo dot pl

A temporary solution is to use INT value (1002) instead of constant.



[2009-06-02 12:15:28] daniz at rocketmail dot com

Looking into 

/ext/pdo_mysql/pdo_mysql.c I saw this:

/* {{{ PHP_MINIT_FUNCTION
 */
static PHP_MINIT_FUNCTION(pdo_mysql)
{
#if PDO_USE_MYSQLND
REGISTER_INI_ENTRIES();
#endif

REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_USE_BUFFERED_QUERY",
(long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_LOCAL_INFILE",
(long)PDO_MYSQL_ATTR_LOCAL_INFILE); 
#ifndef PDO_USE_MYSQLND
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MAX_BUFFER_SIZE",
(long)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND",
(long)PDO_MYSQL_ATTR_INIT_COMMAND);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_FILE",
(long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP",
(long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS",
(long)PDO_MYSQL_ATTR_COMPRESS);
#endif
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY",
(long)PDO_MYSQL_ATTR_DIRECT_QUERY);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_FOUND_ROWS",
(long)PDO_MYSQL_ATTR_FOUND_ROWS);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_IGNORE_SPACE",
(long)PDO_MYSQL_ATTR_IGNORE_SPACE);

#ifdef PDO_USE_MYSQLND
pdo_mysqlnd_zval_cache =
mysqlnd_palloc_init_cache(PDO_MYSQL_G(cache_size));
#endif

return php_pdo_register_driver(&pdo_mysql_driver);
}



Meaning in short:
if not defined "PDO_USE_MYSQLND" -
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND",
(long)PDO_MYSQL_ATTR_INIT_COMMAND);

else don't register that class? Does it's supposed to come from
somewhere else? I just moved the init_command into a simple query("SET
NAMES utf8"); to get rid of the error.



[2009-05-22 04:06:55] christian dot gahlert at web dot de

Hi,

I just had the same problem. It occured because I installed the PDO
extension via pecl but forgot to also install PDO_MYSQL.

After I installed the PDO_MYSQL everything was fine.

I hope I could save someone some time :)
Chris



[2009-04-25 15:35:53] j...@php.net

For some reason this (and some other) constants are only available when

mysqlnd driver is used.



[2009-01-27 12:33:45] contact at joycebabu dot com

Description:

The constant PDO::MYSQL_ATTR_INIT_COMMAND is not available.

Reproduce code:
---
try {
$pdbo = new PDO("mysql:host=localhost;dbname=test", 'root', '',
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}catch(PDOException $e){
echo $e->getMessage();
}


Expected result:

A successful connection to the mysql database

Actual result:
--
Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in
D:\Projects\Apache\htdocs\mysite.com\httpdocs\include\define-vars.inc.php
on line 23





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



#48859 [NEW]: PDO mysql does not support multiple inital queries

2009-07-08 Thread techi at techi dot name
From: techi at techi dot name
Operating system: all
PHP version:  5.2.10
PHP Bug Type: PDO related
Bug description:  PDO mysql does not support multiple inital queries

Description:

When using intial SQL query with PDO::MYSQL_ATTR_INIT_COMMAND, only one 
query can be queried. More queries throws exception SQLSTATE[HY000]: 
General error: 2014

I am not sure, if this is bug or feature or some PDO limitation, but 
sometimes more than one initial query is needed

Reproduce code:
---
$pdo = new PDO( 
'mysql:host=hostname;dbname=defaultDbName', 
'username', 
'password', 
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8;SET time_zone =
'Europe/Prague'") 
); 


Actual result:
--
SQLSTATE[HY000]: General error: 2014

-- 
Edit bug report at http://bugs.php.net/?id=48859&edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48859&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48859&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48859&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48859&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48859&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48859&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=48859&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=48859&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=48859&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=48859&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=48859&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=48859&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=48859&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48859&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=48859&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=48859&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=48859&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=48859&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=48859&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=48859&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=48859&r=mysqlcfg