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

Function PutAlterTableStatement

pkg/sql/ast/pool.go:1479–1510  ·  view source on GitHub ↗

PutAlterTableStatement returns an AlterTableStatement to the pool. It recursively releases nested expressions in column definitions and constraints.

(stmt *AlterTableStatement)

Source from the content-addressed store, hash-verified

1477// PutAlterTableStatement returns an AlterTableStatement to the pool.
1478// It recursively releases nested expressions in column definitions and constraints.
1479func PutAlterTableStatement(stmt *AlterTableStatement) {
1480 if stmt == nil {
1481 return
1482 }
1483
1484 for i := range stmt.Actions {
1485 // Release nested ColumnDef expressions
1486 if stmt.Actions[i].ColumnDef != nil {
1487 for j := range stmt.Actions[i].ColumnDef.Constraints {
1488 PutExpression(stmt.Actions[i].ColumnDef.Constraints[j].Default)
1489 PutExpression(stmt.Actions[i].ColumnDef.Constraints[j].Check)
1490 stmt.Actions[i].ColumnDef.Constraints[j].Default = nil
1491 stmt.Actions[i].ColumnDef.Constraints[j].Check = nil
1492 stmt.Actions[i].ColumnDef.Constraints[j].References = nil
1493 }
1494 stmt.Actions[i].ColumnDef.Constraints = stmt.Actions[i].ColumnDef.Constraints[:0]
1495 stmt.Actions[i].ColumnDef = nil
1496 }
1497 // Release nested TableConstraint expressions
1498 if stmt.Actions[i].Constraint != nil {
1499 PutExpression(stmt.Actions[i].Constraint.Check)
1500 stmt.Actions[i].Constraint.Check = nil
1501 stmt.Actions[i].Constraint = nil
1502 }
1503 stmt.Actions[i].Type = ""
1504 stmt.Actions[i].ColumnName = ""
1505 }
1506 stmt.Actions = stmt.Actions[:0]
1507 stmt.Table = ""
1508
1509 alterTableStmtPool.Put(stmt)
1510}
1511
1512// GetCreateIndexStatement gets a CreateIndexStatement from the pool.
1513func GetCreateIndexStatement() *CreateIndexStatement {

Callers 3

releaseStatementFunction · 0.85

Calls 2

PutExpressionFunction · 0.85
PutMethod · 0.80

Tested by 2