ZF2-485: 'Statement could not be executed'

Issue Type: Bug Created: 2012-08-21T00:42:41.000+0000 Last Updated: 2012-08-22T20:26:15.000+0000 Status: Resolved Fix version(s): Reporter: Thomas R. (thomas_r) Assignee: Ralph Schindler (ralph) Tags: - Zend\Db

  • pdo
  • statement
  • zend\db

Related issues: Attachments:


In pdo\statement, this exception message is totally useless. It could be for a whole variety of reasons that the pdo statement fails from an invalid query to a locked database. The errorinfo is fantastic / the errorcode a good second best. Please can something be done to make this message better.


Posted by John Kelly (postalservice14) on 2012-08-21T14:44:53.000+0000

Well it IS passing the PDO exception as the previous exception for exception chaining. (Geez, how many times can I say exception in a sentence). So the PDO's error code and message should be passed along in the chain and printed out in the stack trace right?

Besides that information all PDO\Statement really knows is that the execution failed. IDK, I think the exception message is fine.

What do you think?

Posted by Ralph Schindler (ralph) on 2012-08-21T17:50:27.000+0000

Try doing this:

<pre class="highlight">
try {
  //... something that fails
} catch (Exception $e) {
  $pdoException = $e->getPrevious();

If you are using the ZFSkeleton Application, it should be designed to show you any previous exceptions that might have occurred.

Posted by Thomas R. (thomas_r) on 2012-08-22T20:26:15.000+0000

Interesting. It is there in the stack trace for web access, but I was working with console. which didn't display it

Have you found an issue?

See the Overview section for more details.


© 2006-2020 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.