Class: Cassie::Testing::Fake::PreparedStatement

Inherits:
Object
  • Object
show all
Defined in:
lib/cassie/testing/fake/prepared_statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(statement) ⇒ PreparedStatement

Returns a new instance of PreparedStatement.



5
6
7
# File 'lib/cassie/testing/fake/prepared_statement.rb', line 5

def initialize(statement)
  @original_statement = statement
end

Instance Attribute Details

#original_statementObject (readonly)

Returns the value of attribute original_statement.



3
4
5
# File 'lib/cassie/testing/fake/prepared_statement.rb', line 3

def original_statement
  @original_statement
end

Instance Method Details

#bind(new_params) ⇒ Object

Creates a statement bound with specific arguments

Cassandra does type checking against connection version which requires a connection.

Note: this fake implementation returns a simple statement not a bound statement. Implementing the latter would require faking the metadata on the prepared statement object which I don’t have reason to do yet



18
19
20
21
22
# File 'lib/cassie/testing/fake/prepared_statement.rb', line 18

def bind(new_params)
  fake_bound = original_statement.clone
  fake_bound.instance_variable_set :@params, new_params
  fake_bound
end