2009年10月20日星期二

Re: [fw-db] Inserting multiple element

I have written a patch for the Pdo_Mysql adapter that adds two methods:

// Inserts multiple rows into a table using one query
int Zend_Db_Adapter_Pdo_Mysql::insertMultiple(string $table, array $rows);

// Inserts multiple rows using ON DUPLICATE KEY UPDATE syntax
int Zend_Db_Adapter_Pdo_Mysql::insertOrUpdateMultiple(string $table, array $insertData, array $updateData = null);

I currently don't have a signed CLA so I need to get that before I can submit the patch. In the mean time, I'll submit the patch to the issue tracker for review.

--
Hector


On Tue, Oct 20, 2009 at 2:14 AM, Саша Стаменковић <umpirsky@gmail.com> wrote:
Also, please vote for http://framework.zend.com/issues/browse/ZF-2322

Regards,
Saša Stamenković



On Tue, Oct 20, 2009 at 11:12 AM, Саша Стаменковић <umpirsky@gmail.com> wrote:
The reason why this is not implemented is that not all RDBMS support bulk insert. But I vote for implementing it for ones that support it and maybe emulate for others or throw unsupported operation exception in that case. It would be nice to have this for at least MySQL.

Regards,
Saša Stamenković



On Tue, Oct 20, 2009 at 10:53 AM, Nicolas GREVET <ngrevet@alteo.fr> wrote:
See: http://framework.zend.com/issues/browse/ZF-2322
It would be a VERY nice feature, especially if it supported bulk update too.
Unfortunately, this is opened since 17/Dec/07 and doesn't seem to be moving soon.
You could still use this method instead :
http://www.mail-archive.com/fw-general@lists.zend.com/msg12741.html

Regards,
-- Nicolas


Mathieu Suen a écrit :

Hi,

Is there a way to insert several row at the same time with the adapter?

The expect query would look like:

INSERT (num) VALUES (2), (3), (6);

Thanks




没有评论: