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

Use JDBC CallableStatements to execute stored procedures. Only supported if the underlying database has stored procedure support.

Methods

call   inspect   run   sproc_type=  

Included Modules

Sequel::Dataset::StoredProcedureMethods

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 11
11:       def call(*args, &block)
12:         sp = clone
13:         sp.sproc_args = args
14:         sp.run(&block)
15:       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 19
19:       def inspect
20:         "<#{self.class.name}/StoredProcedure name=#{@sproc_name}>"
21:       end

Run the stored procedure with the current args on the database

[Source]

    # File lib/sequel/adapters/utils/stored_procedures.rb, line 24
24:       def run(&block)
25:         case @sproc_type
26:         when :select, :all
27:           all(&block)
28:         when :first
29:           first
30:         when :insert
31:           insert
32:         when :update
33:           update
34:         when :delete
35:           delete
36:         end
37:       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 42
42:       def sproc_type=(type)
43:         @sproc_type = type
44:         @opts[:sql] = ''
45:       end

[Validate]