Welcome Guest, Not a member yet? Register   Sign In
Active Record Multiple Insert
#1

[eluser]dmorin[/eluser]
I'm in the process of migrating all of my queries to the active record pattern and I need to run an insert query that inserts multiple rows into one table. The query is something like:
Code:
INSERT INTO table (field1, field2) VALUES (1,1), (2,2), (3,3), (4,4)
At any time, I could be inserting anywhere from one set of data to 100. I would prefer not to run 100 separate insert queries for performance reasons. I can't figure out how to get this to work with Active Record. Passing a multidimensional array to the insert method doesn't work.

Does anyone know how I could go about doing this? Is this capability added in 1.6? Has anyone extended the active record class to add this functionality? Thanks for any help you can provide.


Messages In This Thread
Active Record Multiple Insert - by El Forum - 02-02-2008, 11:20 AM
Active Record Multiple Insert - by El Forum - 02-02-2008, 12:08 PM
Active Record Multiple Insert - by El Forum - 02-02-2008, 01:04 PM
Active Record Multiple Insert - by El Forum - 02-02-2008, 03:55 PM
Active Record Multiple Insert - by El Forum - 02-02-2008, 03:57 PM
Active Record Multiple Insert - by El Forum - 02-02-2008, 05:21 PM
Active Record Multiple Insert - by El Forum - 02-02-2008, 05:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB