2009年7月27日星期一

Re: [fw-db] insert method refactoring

On 07/27/2009 05:52 PM, Саша Стаменковић wrote:
> Yes it is, and there was a chat regarding this, but not all DBMS-es
> support bulk insert, so idea for Zend_Db is to implement abstract db and
> have all adapters...etc

True, but why not to take better efficiency from db? Some time ago i
wrote method like insertBulk($table, $row), it was called as many times
as you need, and after all method was called without parameters to make
insert execute.
With this function you could have different implementation for different
db. Of course if db does not support bulk insert it executes every
insert on single row.

foreach ($data as $row)
$db->insertBulk('table1', $row);

$db->insertBulk('table1'); //this executes sql inserts

--
Piotr Kabacinski
a2Fib3Q

没有评论: