ID:               38737
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mjsabby at gmail dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         PDO related
 Operating System: Fedora Core 5
 PHP Version:      5.1.6
-Assigned To:      
+Assigned To:      wez


Previous Comments:
------------------------------------------------------------------------

[2006-09-07 01:54:04] mjsabby at gmail dot com

Ok, spoke to soon about the QUERY does not matter. I guess the query
matters, so instead of that, put something valid :

"SELECT * FROM thisdoesnotmatter"

------------------------------------------------------------------------

[2006-09-07 01:49:34] mjsabby at gmail dot com

Description:
------------
After looking closely at the previous bug, Bug #38736, which I filed, I
realized I had an incorrectly formatted DSN string.

'mysql:localhost;dbname=xxx'

The above DSN, doesn't throw an exception. It instead goes aheads and
connects to the MySQL server, but doesn't end up selecting the
database.

I found this out (in reference to the previous bug) after I set the PDO
mode to throw exceptions at everything to analyze what really was going
wrong, to which it threw a SQL STATE 1046 No database selected ...

Is this desired functionality or a genuine bug?

Reproduce code:
---------------
<?php

define('DB_DSN', 'mysql:localhost;dbname=xxx');
define('DB_USER', 'xxx');
define('DB_PASS', 'xxx');

try {
 $dbh = new PDO(DB_DSN, DB_USER, DB_PASS);
} catch (PDOException $e) {
 die($e->getMessage());
}

// Didn't catch the exception

$dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);

try { $query = $dbh->query("QUERY Does not matter"); }
catch { PDOException $e) { echo $e->getMessage(); }

$dbh = null;

?>

Expected result:
----------------
An exception to be thrown, prompting an invalid DSN or something.



------------------------------------------------------------------------


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

Reply via email to