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

Function TestReleaseStatementsMixedDDL

pkg/sql/ast/pool_ddl_test.go:909–937  ·  view source on GitHub ↗

============================================================ ReleaseStatements mixed DDL test ============================================================

(t *testing.T)

Source from the content-addressed store, hash-verified

907// ============================================================
908
909func TestReleaseStatementsMixedDDL(t *testing.T) {
910 stmts := []Statement{
911 &CreateTableStatement{Name: "t1"},
912 &AlterTableStatement{Table: "t2"},
913 &CreateIndexStatement{Name: "idx"},
914 &MergeStatement{TargetAlias: "tgt"},
915 &CreateViewStatement{Name: "v1"},
916 &CreateMaterializedViewStatement{Name: "mv1"},
917 &RefreshMaterializedViewStatement{Name: "mv1"},
918 &DropStatement{ObjectType: "TABLE"},
919 &TruncateStatement{Tables: []string{"t1"}},
920 &ShowStatement{ShowType: "TABLES"},
921 &DescribeStatement{TableName: "users"},
922 &ReplaceStatement{TableName: "cache"},
923 &AlterStatement{Name: "r1"},
924 // DML
925 &SelectStatement{TableName: "users"},
926 &InsertStatement{TableName: "orders"},
927 }
928
929 // Should not panic
930 ReleaseStatements(stmts)
931
932 for i, s := range stmts {
933 if s != nil {
934 t.Errorf("stmts[%d] not cleared after ReleaseStatements", i)
935 }
936 }
937}
938
939// ============================================================
940// Benchmarks

Callers

nothing calls this directly

Calls 2

ReleaseStatementsFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected