Module: RDO
- Defined in:
- lib/rdo/driver.rb,
lib/rdo.rb,
lib/rdo/util.rb,
lib/rdo/result.rb,
lib/rdo/version.rb,
lib/rdo/exception.rb,
lib/rdo/statement.rb,
lib/rdo/connection.rb,
lib/rdo/colored_logger.rb,
lib/rdo/emulated_statement_executor.rb
Overview
RDO: Ruby Data Objects. Copyright © 2012 Chris Corbyn.
See LICENSE file for details.
Defined Under Namespace
Modules: Util Classes: ColoredLogger, Connection, Driver, EmulatedStatementExecutor, Exception, Result, Statement
Constant Summary collapse
- VERSION =
"0.1.8"
Class Method Summary collapse
-
.connect(uri, options = {}) ⇒ Connection
(also: open)
Establish a connection to the RDBMS.
Class Method Details
.connect(uri, options = {}) ⇒ Connection Also known as: open
Establish a connection to the RDBMS. The connection will be returned open.
The needed driver must be loaded before calling this.
If a block is given, the connection is passed to the block and then closed at the end of the block, before this method finally returns the result of the block.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rdo.rb', line 41 def connect(uri, = {}) if block_given? begin c = Connection.new(uri, ) yield c ensure c.close unless c.nil? end else Connection.new(uri, ) end end |