ZF-6185: Zend_Db missing an implementation of PDO::exec()

Issue Type: Bug Created: 2009-04-02T00:51:35.000+0000 Last Updated: 2009-04-27T11:43:03.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Lukas Smith (lsmith) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Db

Related issues: Attachments: - patch-zend-db-adapter-abstract.txt


This prevents Zend_Db from being a drop in replacement for PDO applications.


Posted by Lukas Smith (lsmith) on 2009-04-02T00:53:18.000+0000


Posted by Silvan Zurbruegg (silvan) on 2009-04-02T01:35:12.000+0000

patch for Zend/Db/Adapter/Abstract.php.

contains missing function exec()

Posted by Silvan Zurbruegg (silvan) on 2009-04-02T01:36:05.000+0000

unittests for /Zend/Db/Adapter/TestCommon.php

unittests for exec() method.

Posted by Mickael Perraud (mikaelkael) on 2009-04-17T00:43:01.000+0000

Just for my information, why don't you want to use the query() method? (except to retrieve number of rows)

With you proposition, there is also no profiling.

Posted by Lukas Smith (lsmith) on 2009-04-17T01:24:01.000+0000

Two reasons: 1) for certain queries you dont need a result set and therefore creating the statement instance is needless overhead 2) exec() returns the number of affected rows, that I would have to get with another method call if I were to use query()

Posted by Lukas Smith (lsmith) on 2009-04-17T01:26:19.000+0000

Also semantically it is important to know that this is not a select query, for example if one would want to run an explain automatically. These are also usually not the type of queries that need profiling and if they do .. though I invite you to add profiling support.

Finally the lack of the exec() method prevents Zend_Db to work as a drop in replacement for PDO projects.

Posted by Mickael Perraud (mikaelkael) on 2009-04-17T03:59:08.000+0000

Thanks Lukas.

Ralph, I can apply the patch and test it against all PDO adapters with limitation mentions above => no profiling.

Your opinion?

Posted by Matthew Weier O'Phinney (matthew) on 2009-04-26T18:57:08.000+0000

Patch applied to trunk and 1.8 release branch.

Posted by Mickael Perraud (mikaelkael) on 2009-04-27T11:42:19.000+0000

Modified in SVN15204

Tested with all adapters:

<pre class="highlight">
PHPUnit 3.3.15 by Sebastian Bergmann.

Zend Framework - Zend_Db





Time: 10 seconds

There was 1 failure:

1) testAdapterExecModifiedNone(Zend_Db_Adapter_Pdo_PgsqlTest)
Expected exec() to return zero affected rows; got 1
Failed asserting that <<<

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

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