Re: Problems using PDO_MYSQL with MySQL3

From: Date: Fri, 24 Mar 2006 16:57:51 +0000
Subject: Re: Problems using PDO_MYSQL with MySQL3
References: 1 2 3 4 5 6 7 8 9  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-3663@lists.php.net to get a copy of this message
Andrey Hristov wrote:
my guess is: because PDO is compiled against 5.0.18 which has prepared statements it tries to prepare the statement, no matter you don't ask for that explicitly and even because there is no binding. COM_PREPARE is uknown for 3.23 and therefore you get an error. AFAIK it's on the ToDo to make runtime detection of the server the user is connected to try preparing only if supports PS (4.1+).
But why doesn't PDO throw an Exception here? The test-code is: <?php try { $dbh = new PDO('mysql:host=localhost;dbname=test', 'user', 'pass'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $result = $dbh->query('SELECT * FROM test'); var_dump($dbh->errorInfo()); } catch(PDOException $e){ die($e->getMessage()); } ?> $dbh->query() return FALSE $dbh->errorInfo() returns error "Unknown Command" $dbh->getAttribute(PDO::ATTR_ERRMODE) returns "2"
    which is == PDO::ERRMODE_EXCEPTION
shouldn't PDO throw an Exception here? Seems to ignore the errormode set by $dbh->setAttribute(). Before calling $dbh->query() and after calling $dbh->setAttribute() $dbh->errorInfo() returns no error. best regards Andreas

« previous php.pecl.dev (#3663) next »