MCPcopy Create free account
hub / github.com/PostHog/duckgres / trackSQLTransactionState

Function trackSQLTransactionState

duckdbservice/transient.go:35–51  ·  view source on GitHub ↗
(query string, execErr error, sqlTxActive *atomic.Bool)

Source from the content-addressed store, hash-verified

33}
34
35func trackSQLTransactionState(query string, execErr error, sqlTxActive *atomic.Bool) {
36 upper := strings.ToUpper(stripLeadingSQLComments(query))
37 if len(upper) == 0 {
38 return
39 }
40 if isTransactionStartStmt(upper) {
41 if execErr == nil {
42 sqlTxActive.Store(true)
43 }
44 return
45 }
46 if isTransactionControlStmt(upper) {
47 if execErr == nil {
48 sqlTxActive.Store(false)
49 }
50 }
51}
52
53func stripLeadingSQLComments(query string) string {
54 q := strings.TrimSpace(query)

Calls 3

stripLeadingSQLCommentsFunction · 0.85
isTransactionStartStmtFunction · 0.85
isTransactionControlStmtFunction · 0.85