Class: Alf::Adapter::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/alf-adapter/alf/adapter/connection.rb,
lib/alf-adapter/alf/adapter/connection/schema_cached.rb

Direct Known Subclasses

SchemaCached, Folder::Connection

Defined Under Namespace

Classes: SchemaCached

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn_spec) ⇒ Connection

Returns a new instance of Connection.



5
6
7
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 5

def initialize(conn_spec)
  @conn_spec = conn_spec
end

Instance Attribute Details

#conn_specObject (readonly)

Returns the value of attribute conn_spec.



8
9
10
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 8

def conn_spec
  @conn_spec
end

Instance Method Details

#closeObject

Closes the connection



18
19
20
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 18

def close
  @closed = true
end

#closed?Boolean

Checks whether the connection is closed

Returns:

  • (Boolean)


23
24
25
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 23

def closed?
  defined?(@closed) && @closed
end

#cog(name) ⇒ Object

Returns a cog for a given name

Raises:



52
53
54
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 52

def cog(name)
  raise NotSupportedError, "Unable to serve cog `#{name}` in `#{self}`"
end

#compilerObject

Returns a compiler instance



81
82
83
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 81

def compiler
  Engine::Compiler.new
end

#delete(name, predicate) ⇒ Object

Delete from the relvar called ‘name`

Raises:



69
70
71
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 69

def delete(name, predicate)
  raise NotSupportedError, "Unable to delete in `#{self}`"
end

#heading(name) ⇒ Object

Returns the heading of a given named variable

Raises:



35
36
37
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 35

def heading(name)
  raise NotSupportedError, "Unable to serve heading of `#{name}` in `#{self}`"
end

#in_transaction(opts = {}) ⇒ Object

Yields the block in a transaction



13
14
15
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 13

def in_transaction(opts = {})
  yield
end

#insert(name, tuples) ⇒ Object

Inserts ‘tuples` in the relvar called `name`

Raises:



64
65
66
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 64

def insert(name, tuples)
  raise NotSupportedError, "Unable to insert in `#{self}`"
end

#keys(name) ⇒ Object

Returns the keys of a given named variable

Raises:



40
41
42
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 40

def keys(name)
  raise NotSupportedError, "Unable to serve keys of `#{name}` in `#{self}`"
end

#knows?(name) ⇒ Boolean

Returns true if ‘name` is known, false otherwise.

Returns:

  • (Boolean)


30
31
32
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 30

def knows?(name)
  false
end

#lock(name, mode) ⇒ Object

Locks the table with name ‘name`



59
60
61
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 59

def lock(name, mode)
  yield
end

#migrate!(opts) ⇒ Object

Migrate the undelrying database according to adapter semantics.

Raises:



45
46
47
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 45

def migrate!(opts)
  raise NotSupportedError, "Unable to migrate using `#{self}`"
end

#update(name, computation, predicate) ⇒ Object

Updates the relvar called ‘name`

Raises:



74
75
76
# File 'lib/alf-adapter/alf/adapter/connection.rb', line 74

def update(name, computation, predicate)
  raise NotSupportedError, "Unable to update in `#{self}`"
end