-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 James Adam wrote: > On 7/17/06, zdennis <[EMAIL PROTECTED]> wrote: > >> AR is so well thought out and designed, this seems >> like a core feature that is just simply missing. > > > Since you are looking for speed to the point where you are sacrificing > validations, and pretty much anything else vaguely active-record-ish, > beyond getting the table name and establishing the DB connection, this > functionality is at a distance from what ActiveRecord's core (which is > surely being an ORM).
I don't want to bypass validations altogether. I think an option should exist for this yes, but I think that user's should be able to still get validations with the speed of a multi-value insert statement. Granted, AR relies on the insert_id returned by MySQL to set the objec's id of the AR::Base instance you are saving and with a multi-value insert you can't guarantee you'll be able to compute that accurately for every insert value because of threading and multiple connections in the server. You can however, enforce validation and return model objects that didn't save. > > That said, I think providing an 'import' method as a plugin would > certainly be useful to some people (especially those too lazy to > connect to a database by hand). I like to automate tasks, if that makes me lazy, then I am lazy. > Another thing to do might be reworking > it to use prepared statements, for an even bigger speed increase. I like the idea of keeping logic outside of the DB itself. If the way AR saved multiple records were a smidgen slower then using multi-value INSERT statements or LOAD DATA INFILE then I probably wouldn't care. But it's 20 to 30 times slower. A user will wait 2.45 seconds for 1000 records to process,but 50 seconds. And you can return the success/failure rate of what passed validations and what didn't. And by wrapping things in a transaction you could completely rollback from any errors and let the user know that. I can also unit test and functionally test the logic and processing that goes into receiving these data feeds. I can do this all within the same unit tests that I use for my models and my controllers. I can test it from the web upload all the way to the database insertion and any processing/validation in between. I see a far greater benefit when everything adds up then by keeping things separate merely for the sake or ORM purism. Not only for me as a developer but for the user. If the mass here doesn't agree I will continue to develop as a plugin, but wouldn't these common database tasks be considered feature-completing AR, rather then affecting it's stature on ORM purity? Zach -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEu/yrMyx0fW1d8G0RAm7zAJ4qfcJnqDobkVCwXUL7NVcS6SfarQCeLVJM 8FMocdeLrCJzy95QP3r28NA= =Ueh/ -----END PGP SIGNATURE----- _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core