Module: Sequel::Dataset::StoredProcedureMethods

Defined in:
lib/sequel/adapters/utils/stored_procedures.rb

Instance Method Summary collapse

Instance Method Details

#call(*args, &block) ⇒ Object

Call the stored procedure with the given args



12
13
14
# File 'lib/sequel/adapters/utils/stored_procedures.rb', line 12

def call(*args, &block)
  clone(:sproc_args=>args).run(&block)
end

#inspectObject

Programmer friendly string showing this is a stored procedure, showing the name of the procedure.



18
19
20
# File 'lib/sequel/adapters/utils/stored_procedures.rb', line 18

def inspect
  "<#{self.class.name}/StoredProcedure name=#{@sproc_name}>"
end

#run(&block) ⇒ Object

Run the stored procedure with the current args on the database



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sequel/adapters/utils/stored_procedures.rb', line 23

def run(&block)
  case @opts[:sproc_type]
  when :select, :all
    all(&block)
  when :first
    first
  when :insert
    insert
  when :update
    update
  when :delete
    delete
  end
end

#sproc_nameObject

The name of the stored procedure to call



7
8
9
# File 'lib/sequel/adapters/utils/stored_procedures.rb', line 7

def sproc_name
  @opts[:sproc_name]
end