Class: RDBI::Driver::ODBC::Database
- Inherits:
-
RDBI::Database
- Object
- RDBI::Database
- RDBI::Driver::ODBC::Database
- Defined in:
- lib/rdbi/driver/odbc.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
Returns the value of attribute handle.
Instance Method Summary collapse
- #commit ⇒ Object
- #disconnect ⇒ Object
-
#initialize(*args) ⇒ Database
constructor
A new instance of Database.
- #new_statement(query) ⇒ Object
- #ping ⇒ Object
- #rollback ⇒ Object
- #schema ⇒ Object
- #table_schema(table_name) ⇒ Object
- #transaction(&block) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Database
Returns a new instance of Database.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rdbi/driver/odbc.rb', line 49 def initialize(*args) super *args database = @connect_args[:database] || @connect_args[:dbname] || @connect_args[:db] username = @connect_args[:username] || @connect_args[:user] password = @connect_args[:password] || @connect_args[:pass] @handle = ::ODBC.connect(database, username, password) self.database_name = @handle.get_info("SQL_DATABASE_NAME") end |
Instance Attribute Details
#handle ⇒ Object
Returns the value of attribute handle.
47 48 49 |
# File 'lib/rdbi/driver/odbc.rb', line 47 def handle @handle end |
Instance Method Details
#commit ⇒ Object
77 78 79 80 |
# File 'lib/rdbi/driver/odbc.rb', line 77 def commit @handle.commit super end |
#disconnect ⇒ Object
62 63 64 65 66 |
# File 'lib/rdbi/driver/odbc.rb', line 62 def disconnect @handle.rollback @handle.disconnect super end |
#new_statement(query) ⇒ Object
82 83 84 |
# File 'lib/rdbi/driver/odbc.rb', line 82 def new_statement(query) Statement.new(query, self) end |
#ping ⇒ Object
94 95 96 |
# File 'lib/rdbi/driver/odbc.rb', line 94 def ping @handle.connected? end |
#rollback ⇒ Object
72 73 74 75 |
# File 'lib/rdbi/driver/odbc.rb', line 72 def rollback @handle.rollback super end |
#schema ⇒ Object
90 91 92 |
# File 'lib/rdbi/driver/odbc.rb', line 90 def schema raise NotImplementedError, "#schema" end |
#table_schema(table_name) ⇒ Object
86 87 88 |
# File 'lib/rdbi/driver/odbc.rb', line 86 def table_schema(table_name) raise NotImplementedError, "#table_schema" end |
#transaction(&block) ⇒ Object
68 69 70 |
# File 'lib/rdbi/driver/odbc.rb', line 68 def transaction(&block) raise NotImplementedError, "#transaction" end |