Module: DbAgile::Contract::Connection

Included in:
Utils::Full
Defined in:
lib/dbagile/contract/connection.rb

Overview

Connection driven methods of the contract

Instance Method Summary collapse

Instance Method Details

#disconnectObject

Disconnect the adapter and frees all resources.

Returns:

  • true



48
49
50
# File 'lib/dbagile/contract/connection.rb', line 48

def disconnect
  Kernel.raise NotImplementedError
end

#physical_schemaObject

Returns the database schema as a DbAgile::Core::Schema instance



30
31
32
# File 'lib/dbagile/contract/connection.rb', line 30

def physical_schema
  Kernel.raise NotImplementedError
end

#pingObject

Ping the SQL server, returns true if everything is fine. Raises an error otherwise

Returns:

  • true



12
13
14
# File 'lib/dbagile/contract/connection.rb', line 12

def ping
  Kernel.raise NotImplementedError
end

#ping?Boolean

Ping the SQL server, returns true if everything is fine, false otherwise.

Returns:

  • (Boolean)


20
21
22
23
24
25
# File 'lib/dbagile/contract/connection.rb', line 20

def ping?
  ping
  true
rescue StandardError
  false
end

#script2sql(script, buffer = "") ⇒ Object

Converts a schema abstract script to a SQL script

Parameters:

  • a (DbAgile::Core::Migrate::AbstractScript)

    script to run



39
40
41
# File 'lib/dbagile/contract/connection.rb', line 39

def script2sql(script, buffer = "")
  Kernel.raise NotImplementedError
end

#transaction(&block) ⇒ ...

Yields the block inside a transaction.

Adapters are expected to catch the DbAgile::Errors::AbordTransactionError and to rollback the transaction without re-raising the error.

Returns:

  • (...)

    block’s result



60
61
62
# File 'lib/dbagile/contract/connection.rb', line 60

def transaction(&block)
  Kernel.raise NotImplementedError
end