Class: SA

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_record/connection_adapters/sqlanywhere_adapter.rb

Overview

Singleton class to hold a valid instance of the SQLAnywhereInterface across all connections

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSA

Returns a new instance of SA.

Raises:

  • (LoadError)


34
35
36
37
38
39
# File 'lib/active_record/connection_adapters/sqlanywhere_adapter.rb', line 34

def initialize
  require 'sqlanywhere' unless defined? SQLAnywhere
  @api = SQLAnywhere::SQLAnywhereInterface.new()
  raise LoadError, "Could not load SQLAnywhere DBCAPI library" if SQLAnywhere::API.sqlany_initialize_interface(@api) == 0 
  raise LoadError, "Could not initialize SQLAnywhere DBCAPI library" if @api.sqlany_init() == 0 
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



32
33
34
# File 'lib/active_record/connection_adapters/sqlanywhere_adapter.rb', line 32

def api
  @api
end