class OdbcConnection
Attributes
type[RW]
Public Class Methods
new(dsn,db_config)
click to toggle source
# File lib/dbexpect/odbc_connection.rb, line 25 def initialize(dsn,db_config) @connection = ODBC.connect( db_config['database'], db_config['username'], db_config['password'] ) @type = db_config['type'] end
Public Instance Methods
run(stmt)
click to toggle source
# File lib/dbexpect/odbc_connection.rb, line 35 def run(stmt) return [] if stmt.empty? begin query = @connection.run(stmt) res = query.to_a query.drop rescue ODBC::Error => e raise DatabaseException.new(e.message) end res end