On Aug 29, 9:59 am, stephen O''D
<stephen.odonn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Guys,
>
> I have googled and googled and cannot find anything on this.
>
> Basically I am using ActiveRecord outside of Rails as part of a test
> suite. I need to call an Oracle stored procedure, and then use
> standard Active Record finders to query the database.
>
> Is there anyway I can call a stored procedure within Active Record? I
> need to be able to pass the procedure parameters and receive
> parameters out, something like
>
> execute( my_stored_proc(i_input, o_output) );
>
> At the moment I have implemented a solution using the module OCI8,
> which works just fine, but it means I run my stored proc in DB
> connection 1, and query in DB connection 2, so I have to commit 1
> before 2 can see the results, which means I cannot rollback after each
> test!
>
> Can you get access to the OCI8 methods from your Active Record
> connection, or better can I get store proc calls with in and out
> parameters working with standard Active Record functionality?
After another batch of googling, I have concluded you just cannot do
what I want out of the box, but its easily added. I documented what I
did at
http://sodonnell.wordpress.com/2007/08/29/activerecord-oracle-and-stored-procedures/
Basically I had to add a new method to
ActiveRecord::ConnectionAdapters::OracleAdapter that directly call the
OCI8#exec method and it seems to do what I want.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---