module Sequel::Dataset::StoredProcedures

Public Instance Methods

call_sproc(type, name, *args) click to toggle source

For the given type (:select, :first, :insert, :update, or :delete), run the database stored procedure with the given name with the given arguments.

# File lib/sequel/adapters/utils/stored_procedures.rb, line 45
def call_sproc(type, name, *args)
  prepare_sproc(type, name).call(*args)
end
prepare_sproc(type, name) click to toggle source

Transform this dataset into a stored procedure that you can call multiple times with new arguments.

# File lib/sequel/adapters/utils/stored_procedures.rb, line 51
def prepare_sproc(type, name)
  prepare_extend_sproc(self).clone(:sproc_type=>type, :sproc_name=>name, :sql=>'')
end

Private Instance Methods

prepare_extend_sproc(ds) click to toggle source

Extend the dataset with the stored procedure methods.

# File lib/sequel/adapters/utils/stored_procedures.rb, line 58
def prepare_extend_sproc(ds)
  ds.with_extend(StoredProcedureMethods)
end