| Module | Sequel::Dataset::StoredProcedureMethods |
| In: |
lib/sequel_core/adapters/jdbc.rb
lib/sequel_core/dataset/stored_procedures.rb |
Use JDBC CallableStatements to execute stored procedures. Only supported if the underlying database has stored procedure support.
| SQL_QUERY_TYPE | = | Hash.new{|h,k| h[k] = k} |
| sproc_name | [RW] | The name of the stored procedure to call |
Call the prepared statement
# File lib/sequel_core/dataset/stored_procedures.rb, line 11
11: def call(*args, &block)
12: @sproc_args = args
13: case @sproc_type
14: when :select, :all
15: all(&block)
16: when :first
17: first
18: when :insert
19: insert
20: when :update
21: update
22: when :delete
23: delete
24: end
25: end
Programmer friendly string showing this is a stored procedure, showing the name of the procedure.
# File lib/sequel_core/dataset/stored_procedures.rb, line 29
29: def inspect
30: "<#{self.class.name}/StoredProcedure name=#{@sproc_name}>"
31: end
Set the type of the sproc and override the corresponding _sql method to return the empty string (since the result will be ignored anyway).
# File lib/sequel_core/dataset/stored_procedures.rb, line 36
36: def sproc_type=(type)
37: @sproc_type = type
38: meta_def("#{sql_query_type}_sql"){|*a| ''}
39: end