Class: ADBC::Database
- Inherits:
-
Object
- Object
- ADBC::Database
- Defined in:
- lib/adbc/database.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.open(**options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/adbc/database.rb', line 21 def open(**) database = new need_release = true begin .each do |key, value| database.set_option(key, value) end database.init if block_given? yield(database) else need_release = false database end ensure database.release if need_release end end |
Instance Method Details
#connect(**options) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/adbc/database.rb', line 41 def connect(**) connection = Connection.new need_release = true begin .each do |key, value| connection.set_option(key, value) end connection.init(self) if block_given? yield(connection) else need_release = false connection end ensure connection.release if need_release end end |