Class: BetterAuth::Adapters::MSSQL

Inherits:
SQL
  • Object
show all
Defined in:
lib/better_auth/adapters/mssql.rb

Instance Attribute Summary collapse

Attributes inherited from SQL

#connection, #dialect

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from SQL

#count, #create, #delete, #delete_many, #find_many, #find_one, #update, #update_many

Methods inherited from Base

#count, #create, #delete, #delete_many, #find_many, #find_one, #update, #update_many

Constructor Details

#initialize(options = nil, url: nil, connection: nil) ⇒ MSSQL

Returns a new instance of MSSQL.



8
9
10
11
12
13
14
15
16
17
# File 'lib/better_auth/adapters/mssql.rb', line 8

def initialize(options = nil, url: nil, connection: nil)
  unless connection
    require "sequel"
    require "tiny_tds"
  end

  config = options || Configuration.new(secret: Configuration::DEFAULT_SECRET, database: :memory)
  @url = url
  super(config, connection: connection || Sequel.connect(url), dialect: :mssql)
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/better_auth/adapters/mssql.rb', line 6

def url
  @url
end

Instance Method Details

#transactionObject



19
20
21
22
23
# File 'lib/better_auth/adapters/mssql.rb', line 19

def transaction
  return super unless connection.respond_to?(:transaction)

  connection.transaction { yield self }
end