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

Function TestInsertStatement_WithQuery

pkg/sql/ast/sql_coverage_test.go:694–709  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

692}
693
694func TestInsertStatement_WithQuery(t *testing.T) {
695 stmt := &InsertStatement{
696 With: &WithClause{CTEs: []*CommonTableExpr{
697 {Name: "c", Statement: &SelectStatement{Columns: []Expression{&Identifier{Name: "x"}}}},
698 }},
699 TableName: "t",
700 Query: &SelectStatement{Columns: []Expression{&Identifier{Name: "a"}}},
701 Returning: []Expression{&Identifier{Name: "id"}},
702 }
703 sql := stmt.SQL()
704 for _, want := range []string{"WITH", "INSERT INTO", "SELECT", "RETURNING"} {
705 if !strings.Contains(sql, want) {
706 t.Errorf("missing %q in: %s", want, sql)
707 }
708 }
709}
710
711func TestUpdateStatement_WithFromReturning(t *testing.T) {
712 stmt := &UpdateStatement{

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected