mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
add nested transaction with savepoints
This commit is contained in:
parent
9bde76865e
commit
c491bd8962
4 changed files with 243 additions and 3 deletions
|
@ -68,6 +68,29 @@ class DummyDriver < DB::Driver
|
|||
super
|
||||
@rolledback = true
|
||||
end
|
||||
|
||||
protected def create_save_point_transaction(parent, savepoint_name : String)
|
||||
DummySavePointTransaction.new(parent, savepoint_name)
|
||||
end
|
||||
end
|
||||
|
||||
class DummySavePointTransaction < DB::SavePointTransaction
|
||||
getter committed = false
|
||||
getter rolledback = false
|
||||
|
||||
def initialize(parent, savepoint_name)
|
||||
super(parent, savepoint_name)
|
||||
end
|
||||
|
||||
def commit
|
||||
super
|
||||
@committed = true
|
||||
end
|
||||
|
||||
def rollback
|
||||
super
|
||||
@rolledback = true
|
||||
end
|
||||
end
|
||||
|
||||
class DummyStatement < DB::Statement
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue