Subject: Support for multi-row inserts and "insert ignore"?
If you need to create and save hundreds of new objects at once, it can be much more efficient to have one SQL query generated like:INSERT INTO phone_book VALUES ('John Doe', '555-1212'), ('Peter Doe', '555-2323');
Is there any support (or planned support) for this in phpactiverecord?
Additionally, is there any way to do an "INSERT IGNORE"?
No, that's not really on the todo list but if you wanted to implement this and submit a patch that'd be great.
No, to the insert ignore as well.
I haven't started using this yet, just evaluating it for my needs. Especially the first request (multi-insert) seems highly crucial for performance in many situations.
This was something i wanted to do at some point, and the code wouldn't be very difficult to do so. If you wanted to help out I could get you started.
Don't have much time right now (just was passively evaluating frameworks). If I ever do get into using this project I'd be happy to contribute though.
I would also like multi-row inserts, as I think it would enhance performance!
I wanted to accomplish this and had something working but it was very rough and kind of buggy. That was a external implementation but now I'm looking at a proper implementation by changing the source but having a bit of a issue of how to accomplish this and follow active records format.
Suggestions on architecture would be good (built into save function or have a insert_all function). Also processing all the values without adding too much load there. I'm PHP5 certified so wouldn't need baby sitting but would rather submit a patch that got used.
Encotrei uma solução alternativa para varias inserções.
Model::query('insert into table( campos ) values (?), (?)', array( 'valores' , 'valores' ));
Daí basta uma adaptação para cada projeto
espero ter ajudado alguém:)
June 27 2010
April 16, 2013
phpactiverecord.org - An easy to use ORM for PHP