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:
PHPUnit 3.3.15 by Sebastian Bergmann.
Zend Framework - Zend_Db
Zend_Db_Adapter_Pdo_MssqlTest
...
Zend_Db_Adapter_Pdo_MysqlTest
...
Zend_Db_Adapter_Pdo_OciTest
...
Zend_Db_Adapter_Pdo_PgsqlTest
..F
Zend_Db_Adapter_Pdo_SqliteTest
...
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 <<<
Comments
Posted by Lukas Smith (lsmith) on 2009-04-02T00:53:18.000+0000
see http://php.net/manual/en/pdo.exec.php
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: