Class: Alf::Adapter::Connection

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

Defined Under Namespace

Classes: SchemaCached

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn_spec) ⇒ Connection


5
6
7
# File 'lib/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/connection.rb', line 8

def conn_spec
  @conn_spec
end

Instance Method Details

#closeObject

Closes the connection


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

def close
  @closed = true
end

#closed?Boolean

Checks whether the connection is closed


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

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

#cog(plan = nil, expr = nil) ⇒ Object

Returns a base cog for the compilation of `expr` inside the compilation plan `plan`. `expr` is guaranteed to be a `Algebra::Operand::Named`.

Raises:


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

def cog(plan = nil, expr = nil)
  raise NotSupportedError, "Unable to serve cog `#{expr}` in `#{self}`"
end

#delete(name, predicate) ⇒ Object

Delete from the relvar called `name`

Raises:


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

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/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/connection.rb', line 13

def in_transaction(opts = {})
  yield
end

#insert(name, tuples) ⇒ Object

Inserts `tuples` in the relvar called `name`

Raises:


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

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/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.


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

def knows?(name)
  false
end

#lock(name, mode) ⇒ Object

Locks the table with name `name`


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

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/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:


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

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