Here's another solution that doesn't involve constructing as much sql.
You can use the built-in delete_all:
MicroProvenance.delete_all("provenable_id = 9 AND provenable_type = 'Device'
AND field_name = 'wifi_n_ie' AND attachment_source_id NOT IN (54)")
etc...
Then for the insert you can use ar-extensions gem with handles the on
duplicate key and does multiple inserts using a hash.
http://github.com/zdennis/ar-extensions/tree/master/ar-extensions/
Martin Emde
Tw: @martinemde
On Fri, Oct 9, 2009 at 10:51 AM, Guyren G Howe <[email protected]> wrote:
>
> On Oct 9, 2009, at 10:26 , Nic Benders wrote:
>
> > I don't believe that you can pass multiple statements using the
> > connection.execute method. Try breaking it up into 4 different
> > execute statements, wrapped within a transaction if needed.
>
>
> Well, I can't see any way that makes sense.
>
> Thanks.
>
> Regards,
>
> Guyren G Howe
> Relevant Logic LLC
>
> guyren-at-relevantlogic.com ~ http://relevantlogic.com ~ +1 512 784 3178
>
> Ruby/Rails, REALbasic, PHP programming
> PostgreSQL, MySQL database design and consulting
> Technical writing and training
>
> Read my book, Real OOP with REALbasic: <
> http://relevantlogic.com/oop-book/about-the-oop-book.php
> >
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---