Class: Alf::Adapter::Connection
- Inherits:
-
Object
- Object
- Alf::Adapter::Connection
- Defined in:
- lib/alf-adapter/alf/adapter/connection.rb,
lib/alf-adapter/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(name) ⇒ Object
Returns a cog for a given name.
-
#compiler ⇒ Object
Returns a compiler instance.
-
#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 ‘tuples` in the relvar called `name`.
-
#keys(name) ⇒ Object
Returns the keys of a given named variable.
-
#knows?(name) ⇒ Boolean
Returns true if ‘name` is 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/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/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/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/alf/adapter/connection.rb', line 23 def closed? defined?(@closed) && @closed end |
#cog(name) ⇒ Object
Returns a cog for a given name
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 |
#compiler ⇒ Object
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`
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
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`
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
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.
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.
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`
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 |