Class: RDO::EmulatedStatementExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/rdo/emulated_statement_executor.rb

Overview

This StatementExecutor is used as a fallback for prepared statements.

If a DBMS driver does not implement prepared statements, this is used instead. The #execute method simply delegates back to the driver.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver, command) ⇒ EmulatedStatementExecutor

Initialize a new statement executor for the given driver & command.

Parameters:

  • driver (RDO::Driver)

    the Driver on which #prepare was invoked

  • command (String)

    a string of SQL/DDL to execute



23
24
25
26
# File 'lib/rdo/emulated_statement_executor.rb', line 23

def initialize(driver, command)
  @driver  = driver
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



14
15
16
# File 'lib/rdo/emulated_statement_executor.rb', line 14

def command
  @command
end

Instance Method Details

#execute(*args) ⇒ Object

Execute the command using the given bind values.

Parameters:

  • args (Object...)

    bind parameters to use in place of ‘?’



32
33
34
# File 'lib/rdo/emulated_statement_executor.rb', line 32

def execute(*args)
  @driver.execute(command, *args)
end