Class: Alf::Adapter::Connection
- Inherits:
-
Object
- Object
- Alf::Adapter::Connection
- Defined in:
- lib/alf/adapter/connection.rb,
lib/alf/adapter/connection/schema_cached.rb
Direct Known Subclasses
Defined Under Namespace
Classes: SchemaCached
Instance Attribute Summary collapse
-
#conn_spec ⇒ Object
readonly
Returns the value of attribute conn_spec.
Instance Method Summary collapse
-
#close ⇒ Object
Closes the connection.
-
#closed? ⇒ Boolean
Checks whether the connection is closed.
-
#cog(plan = nil, expr = nil) ⇒ Object
Returns a base cog for the compilation of
exprinside the compilation planplan. -
#delete(name, predicate) ⇒ Object
Delete from the relvar called
name. -
#heading(name) ⇒ Object
Returns the heading of a given named variable.
-
#in_transaction(opts = {}) ⇒ Object
Yields the block in a transaction.
-
#initialize(conn_spec) ⇒ Connection
constructor
A new instance of Connection.
-
#insert(name, tuples) ⇒ Object
Inserts
tuplesin the relvar calledname. -
#keys(name) ⇒ Object
Returns the keys of a given named variable.
-
#knows?(name) ⇒ Boolean
Returns true if
nameis known, false otherwise. -
#lock(name, mode) ⇒ Object
Locks the table with name
name. -
#migrate!(opts) ⇒ Object
Migrate the undelrying database according to adapter semantics.
-
#update(name, computation, predicate) ⇒ Object
Updates the relvar called
name.
Constructor Details
#initialize(conn_spec) ⇒ Connection
Returns a new instance of 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_spec ⇒ Object (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
#close ⇒ Object
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.
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
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
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
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
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.
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
75 76 77 |
# File 'lib/alf/adapter/connection.rb', line 75 def update(name, computation, predicate) raise NotSupportedError, "Unable to update in `#{self}`" end |