Class: MetaDb::Connection
- Inherits:
-
Object
- Object
- MetaDb::Connection
- Defined in:
- lib/meta_db/connection.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #database ⇒ Object
-
#escape(s) ⇒ Object
Escapes s as a SQL string value.
- #execute(sql) ⇒ Object
- #host ⇒ Object
-
#initialize(options) ⇒ Connection
constructor
In derived classes, no initialization may take place after the call to super because otherwise #initialize would call the user-supplied block with a partial initialized object.
- #password ⇒ Object
- #port ⇒ Object
- #select(sql, &block) ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(options) ⇒ Connection
In derived classes, no initialization may take place after the call to super because otherwise #initialize would call the user-supplied block with a partial initialized object
7 8 9 |
# File 'lib/meta_db/connection.rb', line 7 def initialize() @conn = self.class.connect() end |
Class Method Details
.open(options, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/meta_db/connection.rb', line 11 def self.open(, &block) if block_given? begin conn = self.new() return yield(conn) ensure conn&.close end else self.new() end end |
Instance Method Details
#close ⇒ Object
36 |
# File 'lib/meta_db/connection.rb', line 36 def close() raise end |
#closed? ⇒ Boolean
37 |
# File 'lib/meta_db/connection.rb', line 37 def closed?() raise end |
#database ⇒ Object
26 |
# File 'lib/meta_db/connection.rb', line 26 def database() raise end |
#escape(s) ⇒ Object
Escapes s as a SQL string value
31 |
# File 'lib/meta_db/connection.rb', line 31 def escape(s) raise end |
#execute(sql) ⇒ Object
33 |
# File 'lib/meta_db/connection.rb', line 33 def execute(sql) raise end |
#host ⇒ Object
24 |
# File 'lib/meta_db/connection.rb', line 24 def host() raise end |
#password ⇒ Object
28 |
# File 'lib/meta_db/connection.rb', line 28 def password() raise end |
#port ⇒ Object
25 |
# File 'lib/meta_db/connection.rb', line 25 def port() raise end |
#select(sql, &block) ⇒ Object
34 |
# File 'lib/meta_db/connection.rb', line 34 def select(sql, &block) raise end |
#user ⇒ Object
27 |
# File 'lib/meta_db/connection.rb', line 27 def user() raise end |