Module: Sequel::Dataset::StoredProcedureMethods
- Defined in:
- lib/sequel_core/dataset/stored_procedures.rb
Constant Summary collapse
- SQL_QUERY_TYPE =
Hash.new{|h,k| h[k] = k}
Instance Attribute Summary collapse
-
#sproc_name ⇒ Object
The name of the stored procedure to call.
Instance Method Summary collapse
-
#call(*args, &block) ⇒ Object
Call the prepared statement.
-
#inspect ⇒ Object
Programmer friendly string showing this is a stored procedure, showing the name of the procedure.
-
#sproc_type=(type) ⇒ Object
Set the type of the sproc and override the corresponding _sql method to return the empty string (since the result will be ignored anyway).
Instance Attribute Details
#sproc_name ⇒ Object
The name of the stored procedure to call
8 9 10 |
# File 'lib/sequel_core/dataset/stored_procedures.rb', line 8 def sproc_name @sproc_name end |
Instance Method Details
#call(*args, &block) ⇒ Object
Call the prepared statement
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sequel_core/dataset/stored_procedures.rb', line 11 def call(*args, &block) @sproc_args = args case @sproc_type when :select, :all all(&block) when :first first when :insert insert when :update update when :delete delete end end |
#inspect ⇒ Object
Programmer friendly string showing this is a stored procedure, showing the name of the procedure.
29 30 31 |
# File 'lib/sequel_core/dataset/stored_procedures.rb', line 29 def inspect "<#{self.class.name}/StoredProcedure name=#{@sproc_name}>" end |
#sproc_type=(type) ⇒ Object
Set the type of the sproc and override the corresponding _sql method to return the empty string (since the result will be ignored anyway).
36 37 38 39 |
# File 'lib/sequel_core/dataset/stored_procedures.rb', line 36 def sproc_type=(type) @sproc_type = type ("#{sql_query_type}_sql"){|*a| ''} end |