#48859 [Com]: PDO mysql does not support multiple inital queries
| From: | Ivo at UFO-Net dot nl | Date: | Thu, 19 Nov 2009 00:12:06 +0000 |
| Subject: | #48859 [Com]: PDO mysql does not support multiple inital queries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-144781@lists.php.net to get a copy of this message | ||
ID: 48859
Comment by: Ivo at UFO-Net dot nl
Reported By: techi at techi dot name
Status: Open
Bug Type: Feature/Change Request
Operating System: *
PHP Version: 5.2.10
New Comment:
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."
Previous Comments:
------------------------------------------------------------------------
[2009-07-22 07:46:54] kalle@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/?id=48859&edit=1