Bug #51596 [Opn->Asn]: Exception when creating database with PDO
| From: | felipe@php.net | Date: | Fri, 23 Apr 2010 17:03:13 +0000 |
| Subject: | Bug #51596 [Opn->Asn]: Exception when creating database with PDO | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149829@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51596&edit=1
ID: 51596
Updated by: felipe@php.net
Reported by: foo-script at o2 dot pl
Summary: Exception when creating database with PDO
-Status: Open
+Status: Assigned
Type: Bug
Package: PDO related
Operating System: Windows XP SP3
PHP Version: 5.3.2
-Assigned To:
+Assigned To: mysql
Previous Comments:
------------------------------------------------------------------------
[2010-04-19 02:40:18] foo-script at o2 dot pl
Description:
------------
A "test script" produced following exception:
exception 'PDOException' with message 'SQLSTATE[HY000]: General error'
in L:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\readme.php:44 Stack trace: #0 L:\Program
Files\Apache Software Foundation\Apache2.2\htdocs\readme.php(44):
unknown() #1 {main}
However, database have been successfuly created.
Test script:
---------------
try{
$pdo=new
PDO('mysql:host='.$dbHost.';'.'dbname=mysql;'.'port='.$port,
'root', $dbKey, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES
\'UTF8\''));
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$result=$pdo->query('CREATE DATABASE test;'); }
Expected result:
----------------
In my opinion exception should not be thrown, cause effect is good.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51596&edit=1