Add sqlite3.isInsideTransaction

This commit is contained in:
Zahary Karadjov 2022-08-19 01:24:19 +03:00 committed by andri lim
parent 4c70293883
commit 3a0afa4aa2
1 changed files with 7 additions and 4 deletions

View File

@ -57,6 +57,9 @@ template dispose(db: RawStmtPtr) =
template dispose*(db: SqliteStmt) =
discard sqlite3_finalize(RawStmtPtr db)
func isInsideTransaction*(db: SqStoreRef): bool =
sqlite3_get_autocommit(db.env) == 0
proc release[T](x: var AutoDisposed[T]): T =
result = x.val
x.val = nil