This class implements access to stored procedures. It must not be used directly but you should inherit from this class.

Methods
Public Class methods
call( params = {}, conditions = {}, options = {} )

executes the stored procedure

# File lib/momomoto/procedure.rb, line 91
      def call( params = {}, conditions = {}, options = {} )
        initialize_procedure unless initialized
        sql = "SELECT #{columns.keys.join(',')} FROM "
        sql += "#{full_name}(#{compile_parameter(params)})"
        sql += compile_where( conditions )
        sql += compile_order( options[:order] ) if options[:order]
        sql += compile_limit( options[:limit] ) if options[:limit]
        sql += ';'
        data = []
        database.execute( sql ).each do | row |
          data << const_get(:Row).new( row )
        end
        data
      end
columns( c = nil )

gets the columns of the result set this procedure returns returns a hash with the field names as keys and the datatype as values

# File lib/momomoto/procedure.rb, line 73
      def columns( c = nil )
        return self.columns=( c ) if c
        initialize_procedure if not instance_variable_defined?( :@columns )
        @columns
      end
columns=( columns )

sets the columns of the result set this procedure returns expects a hash with the field names as keys and the datatype as values

# File lib/momomoto/procedure.rb, line 67
      def columns=( columns )
        @columns = columns
      end
parameters( *p )

gets the parameters this procedure accepts returns an array of hashes with the field names as keys and the datatype as values

# File lib/momomoto/procedure.rb, line 59
      def parameters( *p )
        return self.send( :parameters=, *p ) if not p.empty?
        initialize_procedure if not instance_variable_defined?( :@parameters )
        @parameters
      end
parameters=( *p )

sets the parameters this procedures accepts example: parameters = {:param1=>Momomoto::Datatype::Text.new}

# File lib/momomoto/procedure.rb, line 52
      def parameters=( *p )
        p = p.flatten
        @parameters = p
      end
procedure_name( procedure_name = nil )

gets the procedure name

# File lib/momomoto/procedure.rb, line 37
      def procedure_name( procedure_name = nil )
        return self.procedure_name=( procedure_name ) if procedure_name
        if not instance_variable_defined?( :@procedure_name )
          self.procedure_name = construct_procedure_name( self.name )
        end
        @procedure_name
      end
procedure_name=( procedure_name )

sets the procedure name

# File lib/momomoto/procedure.rb, line 32
      def procedure_name=( procedure_name )
        @procedure_name = procedure_name
      end