Class: RDBI::Driver::ODBC::Database

Inherits:
RDBI::Database
  • Object
show all
Defined in:
lib/rdbi/driver/odbc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#handleObject

Returns the value of attribute handle.



47
48
49
# File 'lib/rdbi/driver/odbc.rb', line 47

def handle
  @handle
end

Instance Method Details

#commitObject



77
78
79
80
# File 'lib/rdbi/driver/odbc.rb', line 77

def commit
  @handle.commit
  super
end

#disconnectObject



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

#pingObject



94
95
96
# File 'lib/rdbi/driver/odbc.rb', line 94

def ping
  @handle.connected?
end

#rollbackObject



72
73
74
75
# File 'lib/rdbi/driver/odbc.rb', line 72

def rollback
  @handle.rollback
  super
end

#schemaObject

Raises:

  • (NotImplementedError)


90
91
92
# File 'lib/rdbi/driver/odbc.rb', line 90

def schema
  raise NotImplementedError, "#schema"
end

#table_schema(table_name) ⇒ Object

Raises:

  • (NotImplementedError)


86
87
88
# File 'lib/rdbi/driver/odbc.rb', line 86

def table_schema(table_name)
  raise NotImplementedError, "#table_schema"
end

#transaction(&block) ⇒ Object

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/rdbi/driver/odbc.rb', line 68

def transaction(&block)
  raise NotImplementedError, "#transaction"
end