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

 ID:                 48859
 Updated by:         u...@php.net
 Reported by:        techi at techi dot name
 Summary:            PDO mysql does not support multiple inital queries
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   *
 PHP Version:        5.2.10
 Block user comment: N

 New Comment:

It is a security and portability matter: you do not want to allow the
execution of multiple statement per one operation by default. It opens
up the door for SQL injection. Disabling the feature by default is also
what mysqli does. 



Also, it is a matter of portability - shouldn't PDO try to use portable
defaults?


Previous Comments:
------------------------------------------------------------------------
[2009-11-19 00:12:05] Ivo at UFO-Net dot nl

The following workaround works for me:

SET NAMES utf8,time_zone = '+0:00'



This is possible at least for SET commands. More information about SET
is available in the MySQL manual:
http://dev.mysql.com/doc/refman/5.1/en/set-option.html. It states that
"A SET  statement can contain multiple variable assignments, separated
by commas."

------------------------------------------------------------------------
[2009-07-22 07:46:54] ka...@php.net

The question here is trival, because internally we use
mysql_options(MYSQL_INIT_COMMAND) which does not support multiple
queries then. We could probably work around it with some hackish code,
but I'll leave this up to the mysql guys to judge

------------------------------------------------------------------------
[2009-07-08 22:59:46] techi at techi dot name

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 this bug report at http://bugs.php.net/bug.php?id=48859&edit=1

Reply via email to