class CQL::Postgres::TransactionScope

Overview

An open transaction on one pooled connection. Statements run using(scope) join it, and #savepoint nests inside it. The scope is only good for the block it was given to: afterwards the connection is back in the pool, so using it again raises TransactionClosed.

Included Modules

Defined in:

postgres/transaction_scope.cr

Constructors

Instance Method Summary

Instance methods inherited from module CQL::Postgres::QueryStreaming

stream(query : String, args : Array(DB::Any) = [] of ::DB::Any, fetch_size : Int32 = 1000, timeout : Time::Span | Nil = nil, & : DB::ResultSet -> T) : T forall T
stream(query : Q, fetch_size : Int32 = 1000, timeout : Time::Span | Nil = nil, & : DB::ResultSet -> T) : T forall Q, T
stream

Instance methods inherited from module CQL::Executor

adapter : Adapter adapter, exec_query(& : DB::Connection -> _) exec_query

Constructor Detail

def self.new(adapter : CQL::Adapter, connection : Connection, transaction : DB::Transaction) #

[View source]

Instance Method Detail

def adapter : CQL::Adapter #

[View source]
def exec_query(& : DB::Connection -> _) #

[View source]
def savepoint(& : TransactionScope -> T) : T | Nil forall T #

Runs the block inside a SAVEPOINT: if it raises, only its own work is rolled back to the savepoint and the exception propagates (raise DB::Rollback to undo it quietly, which makes this return nil). The yielded scope can open savepoints of its own.


[View source]