Class: DBI::DBD::MSSQL::Driver

Inherits:
BaseAdonetDriver
  • Object
show all
Defined in:
lib/dbd/mssql/driver.rb

Constant Summary collapse

PROVIDER_KEY =
:mssql

Instance Method Summary collapse

Constructor Details

#initializeDriver

Returns a new instance of Driver.



9
10
11
# File 'lib/dbd/mssql/driver.rb', line 9

def initialize
  super(DBI::IRONRUBY::USES_DBD_VERSION, PROVIDER_KEY)
end

Instance Method Details

#connect(db_args, user, auth, attr) ⇒ Object

Connect to the database. DBD Required.



14
15
16
17
18
19
20
21
22
# File 'lib/dbd/mssql/driver.rb', line 14

def connect(db_args, user, auth, attr)
  connection = factory.create_connection
#          db_args = "#{db_args}; MultipleActiveResultSets=true;" unless db_args =~ /MultipleActiveResultSets/i
  connection.connection_string = db_args
  connection.open
  return create_database(connection, attr);
rescue RuntimeError, System::Data::SqlClient::SqlException => err
  raise DBI::DatabaseError.new(err.message)
end

#create_database(connection, attr) ⇒ Object



24
25
26
# File 'lib/dbd/mssql/driver.rb', line 24

def create_database(connection, attr)
  Database.new(connection, attr)
end