Volume insert in zend framework

Possible duplicate:
How to add multiple lines to Zend_Db?

everything

I need to have bulk insert in zend framework. For normal sql, I have the following query, I want to do the same in zend framework.

INSERT INTO `dbname`.'tablename` (`id`, `user_id`, `screen_name`, `screen_name_server`) VALUES (NULL, '15', 'test', 'test'), (NULL, '15', 'test', 'test'); 

Thanks.

+8
mysql zend-framework
source share
2 answers

There is no way to do this, as Marchin states.

If you want to work a little with the Zend Framework, you could try changing the paste.

You can try to make the insert method take an array of arrays for the data. You can then use the datasets to build the bulk insert.

For example,

 $data1 = array( ); //data for first insert $data2 = array( ); //data for 2nd insert //a zend_db_table object $dbTable->insert( array( $data1, $data, ) );
$data1 = array( ); //data for first insert $data2 = array( ); //data for 2nd insert //a zend_db_table object $dbTable->insert( array( $data1, $data, ) ); 

You will have to change the insertion method a bit to detect multiple data attachments, and then build the insert accordingly. Unfortunately, I did not learn how to create the code, or I just posted it here for you.

+8
source share

There is no insert method in zend_db that inserts multiple rows. However, you can use the query method Zend_Db_Adapter and add your own sql file there.

+5
source share

All Articles