Class: RDBI::Driver::Mock::STH
- Inherits:
-
Statement
- Object
- Statement
- RDBI::Driver::Mock::STH
- Defined in:
- lib/rdbi/driver/mock.rb
Overview
XXX STUB
Instance Attribute Summary collapse
-
#affected_count ⇒ Object
Returns the value of attribute affected_count.
-
#input_type_map ⇒ Object
Returns the value of attribute input_type_map.
-
#result ⇒ Object
Returns the value of attribute result.
-
#set_schema ⇒ Object
Returns the value of attribute set_schema.
Instance Method Summary collapse
-
#initialize(query, dbh) ⇒ STH
constructor
A new instance of STH.
-
#new_execution(*binds) ⇒ Object
just to be abundantly clear, this is a mock method intended to facilitate tests.
Constructor Details
#initialize(query, dbh) ⇒ STH
Returns a new instance of STH.
16 17 18 19 |
# File 'lib/rdbi/driver/mock.rb', line 16 def initialize(query, dbh) super prep_finalizer end |
Instance Attribute Details
#affected_count ⇒ Object
Returns the value of attribute affected_count.
12 13 14 |
# File 'lib/rdbi/driver/mock.rb', line 12 def affected_count @affected_count end |
#input_type_map ⇒ Object
Returns the value of attribute input_type_map.
14 15 16 |
# File 'lib/rdbi/driver/mock.rb', line 14 def input_type_map @input_type_map end |
#result ⇒ Object
Returns the value of attribute result.
11 12 13 |
# File 'lib/rdbi/driver/mock.rb', line 11 def result @result end |
#set_schema ⇒ Object
Returns the value of attribute set_schema.
13 14 15 |
# File 'lib/rdbi/driver/mock.rb', line 13 def set_schema @set_schema end |
Instance Method Details
#new_execution(*binds) ⇒ Object
just to be abundantly clear, this is a mock method intended to facilitate tests.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rdbi/driver/mock.rb', line 23 def new_execution(*binds) this_data = if result result else (0..4).to_a.collect do |x| binds.collect do |bind| case bind when Integer bind + x else bind.to_s + x.to_s end end end end return Mock::Cursor.new(this_data), @set_schema || RDBI::Schema.new((0..9).to_a.map { |x| RDBI::Column.new(x) }), RDBI::Type.create_type_hash(RDBI::Type::Out) end |