Class: RDO::Statement
- Inherits:
-
Object
- Object
- RDO::Statement
- Extended by:
- Forwardable
- Defined in:
- lib/rdo/statement.rb
Overview
Represents a prepared statement.
This class actually just wraps a StatementExecutor, which only needs to conform to a duck-type
Instance Method Summary collapse
-
#execute(*bind_values) ⇒ Object
Execute the command using the given bind values.
-
#initialize(executor, logger) ⇒ Statement
constructor
Initialize a new Statement wrapping the given StatementExecutor.
Constructor Details
Instance Method Details
#execute(*bind_values) ⇒ Object
Execute the command using the given bind values.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rdo/statement.rb', line 33 def execute(*bind_values) t = Time.now @executor.execute(*bind_values).tap do |rs| rs.info[:execution_time] ||= Time.now - t if logger.debug? logger.debug( "(%.6f) %s %s" % [ rs.execution_time, command, ("<Bind: #{bind_values.inspect}>" unless bind_values.empty?) ] ) end end rescue RDO::Exception => e logger.fatal(e.) if logger.fatal? raise end |