MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / PutInsertStatement

Function PutInsertStatement

pkg/sql/ast/pool.go:551–577  ·  view source on GitHub ↗

PutInsertStatement returns an InsertStatement to the pool

(stmt *InsertStatement)

Source from the content-addressed store, hash-verified

549
550// PutInsertStatement returns an InsertStatement to the pool
551func PutInsertStatement(stmt *InsertStatement) {
552 if stmt == nil {
553 return
554 }
555
556 // Clean up expressions
557 for i := range stmt.Columns {
558 PutExpression(stmt.Columns[i])
559 stmt.Columns[i] = nil
560 }
561 // Clean up multi-row values
562 for i := range stmt.Values {
563 for j := range stmt.Values[i] {
564 PutExpression(stmt.Values[i][j])
565 stmt.Values[i][j] = nil
566 }
567 stmt.Values[i] = stmt.Values[i][:0]
568 }
569
570 // Reset slices but keep capacity
571 stmt.Columns = stmt.Columns[:0]
572 stmt.Values = stmt.Values[:0]
573 stmt.TableName = ""
574
575 // Return to pool
576 insertStmtPool.Put(stmt)
577}
578
579// GetUpdateStatement gets an UpdateStatement from the pool
580func GetUpdateStatement() *UpdateStatement {

Callers 4

releaseStatementFunction · 0.85
TestInsertStatementPoolFunction · 0.85
TestPoolReuseFunction · 0.85

Calls 2

PutExpressionFunction · 0.85
PutMethod · 0.80

Tested by 3

TestInsertStatementPoolFunction · 0.68
TestPoolReuseFunction · 0.68