MCPcopy
hub / github.com/Masterminds/squirrel / Clear

Method Clear

stmtcacher.go:82–103  ·  view source on GitHub ↗

Clear removes and closes all the currently cached prepared statements

()

Source from the content-addressed store, hash-verified

80
81// Clear removes and closes all the currently cached prepared statements
82func (sc *StmtCache) Clear() (err error) {
83 sc.mu.Lock()
84 defer sc.mu.Unlock()
85
86 for key, stmt := range sc.cache {
87 delete(sc.cache, key)
88
89 if stmt == nil {
90 continue
91 }
92
93 if cerr := stmt.Close(); cerr != nil {
94 err = cerr
95 }
96 }
97
98 if err != nil {
99 return fmt.Errorf("one or more Stmt.Close failed; last error: %v", err)
100 }
101
102 return
103}
104
105type DBProxyBeginner interface {
106 DBProxy

Callers 1

TestStmtCachePrepareFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestStmtCachePrepareFunction · 0.76