rsim/ruby-plsql — pull request #31 by flash-gordon (2012-06-12 20:10:45+00:00)
Title: Added basic pipeliened functions support

Hi Raimonds!

At my work I have a lot of pipelined functions that generates small sets of data. Everyone of them take parameters (e.g. user_id) and returns a list of rows (see my spec for example). It it very convenient API between our Oracle DB application and RoR interface. So I plan to create a gem that will alllow to set a pipelined function as standard ActiveRecord table. I think it's better than reinventing the wheel.

First of all I need a list of arguments and return type description of function so I took your gem and change code of procedure calls. I have to refactored it a little bit :)

And sorry for my English :)

My changes:

#### .gitignore
I use RubyMine so it creates it's .idea work directory.

#### package.rb
Create several class method for object searching. Just for clarity
Package object now can return procedures or types by “find” method. If
there are FIND procedure then last will be called (still can use
__find__ synonym).

#### pipelined_function.rb
Inherited from Procedure class (but I think both of them should be
inherited from Subprogram). Three finders and custom “exec” method.
That's all.

#### pipelined_function_call.rb
Custom SQL building and data fetching.

#### procedure.rb
Find method rewritten. All queries now use ALL_PROCEDURES (with filter
by PIPELINED field).

#### procedure_call.rb
Code moved to subprogram_call.rb. Only SQL construction and execution
was left (and DBMS_OUTPUT as well for a while).

#### subprogram_call.rb
Just all good stuff from ProcedureCall but refactored a bit. I tried to
dry it.

#### ruby_plsql.rb
Add new files for requiring.

#### spec_helper.rb
I have to insert DATABASE_USE_TNS_NAMES environment variable for correct
testing. I always use TNS_NAMES and SSH tunnels to connect to Oracle. So
I must leave host and port empty.