Class: Libsql::Connection
Instance Method Summary collapse
- #close ⇒ Object
- #execute_batch(sql) ⇒ Object
-
#initialize(inner) ⇒ Connection
constructor
A new instance of Connection.
- #prepare(sql) ⇒ Object
- #transaction ⇒ Object
Methods included from Prepareable
Constructor Details
#initialize(inner) ⇒ Connection
Returns a new instance of Connection.
375 376 377 |
# File 'lib/libsql.rb', line 375 def initialize(inner) @inner = inner end |
Instance Method Details
#close ⇒ Object
404 |
# File 'lib/libsql.rb', line 404 def close = @inner.deinit |
#execute_batch(sql) ⇒ Object
402 |
# File 'lib/libsql.rb', line 402 def execute_batch(sql) = @inner.execute_batch(sql) |
#prepare(sql) ⇒ Object
394 395 396 397 398 399 400 |
# File 'lib/libsql.rb', line 394 def prepare(sql) stmt = Statement.new @inner.prepare sql return stmt unless block_given? begin yield stmt ensure stmt.close end end |
#transaction ⇒ Object
379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/libsql.rb', line 379 def transaction tx = Transaction.new @inner.transaction return tx unless block_given? abort = false begin yield self rescue StandardError abort = true raise ensure abort and tx.rollback or tx.commit end end |