Module Sequel::Dataset::StoredProcedureMethods
In: lib/sequel/adapters/utils/stored_procedures.rb

Methods

call   inspect   run   sproc_type=  

Attributes

sproc_args  [W]  The name of the stored procedure to call
sproc_name  [RW]  The name of the stored procedure to call

Public Instance methods

Call the stored procedure with the given args

[Source]

    # File lib/sequel/adapters/utils/stored_procedures.rb, line 13
13:       def call(*args, &block)
14:         sp = clone
15:         sp.sproc_args = args
16:         sp.run(&block)
17:       end

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

[Source]

    # File lib/sequel/adapters/utils/stored_procedures.rb, line 21
21:       def inspect
22:         "<#{self.class.name}/StoredProcedure name=#{@sproc_name}>"
23:       end

Run the stored procedure with the current args on the database

[Source]

    # File lib/sequel/adapters/utils/stored_procedures.rb, line 26
26:       def run(&block)
27:         case @sproc_type
28:         when :select, :all
29:           all(&block)
30:         when :first
31:           first
32:         when :insert
33:           insert
34:         when :update
35:           update
36:         when :delete
37:           delete
38:         end
39:       end

Set the type of the stored procedure and override the corresponding _sql method to return the empty string (since the result will be ignored anyway).

[Source]

    # File lib/sequel/adapters/utils/stored_procedures.rb, line 44
44:       def sproc_type=(type)
45:         @sproc_type = type
46:         @opts[:sql] = ''
47:       end

[Validate]