MCPcopy
hub / github.com/pingcap/tidb / runSQL

Function runSQL

pkg/planner/core/preprocess_test.go:41–53  ·  view source on GitHub ↗
(t *testing.T, ctx sessionctx.Context, is infoschema.InfoSchema, sql string, inPrepare bool, terr error)

Source from the content-addressed store, hash-verified

39)
40
41func runSQL(t *testing.T, ctx sessionctx.Context, is infoschema.InfoSchema, sql string, inPrepare bool, terr error) {
42 stmts, err := session.Parse(ctx, sql)
43 require.NoErrorf(t, err, "sql: %s", sql)
44 require.Len(t, stmts, 1)
45 stmt := stmts[0]
46 var opts []core.PreprocessOpt
47 if inPrepare {
48 opts = append(opts, core.InPrepare)
49 }
50 nodeW := resolve.NewNodeW(stmt)
51 err = core.Preprocess(context.Background(), ctx, nodeW, append(opts, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))...)
52 require.Truef(t, terror.ErrorEqual(err, terr), "sql: %s, err:%v", sql, err)
53}
54
55func TestValidator(t *testing.T) {
56 tests := []struct {

Callers 4

TestValidatorFunction · 0.85
TestForeignKeyFunction · 0.85
TestDropGlobalTempTableFunction · 0.85
TestLargeVarcharAutoConvFunction · 0.85

Calls 6

ParseFunction · 0.92
NewNodeWFunction · 0.92
PreprocessFunction · 0.92
WithPreprocessorReturnFunction · 0.92
ErrorEqualFunction · 0.92
LenMethod · 0.65

Tested by

no test coverage detected