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

Function TestBuiltinFuncFlen

pkg/planner/core/plan_cache_test.go:1288–1313  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1286}
1287
1288func TestBuiltinFuncFlen(t *testing.T) {
1289 // same as TestIssue45378 and TestIssue45253
1290 store := testkit.CreateMockStore(t)
1291 tk := testkit.NewTestKit(t, store)
1292 tk.MustExec("use test")
1293 tk.MustExec(`CREATE TABLE t1(c1 INT)`)
1294 tk.MustExec(`INSERT INTO t1 VALUES (1)`)
1295
1296 funcs := []string{ast.Abs, ast.Acos, ast.Asin, ast.Atan, ast.Ceil, ast.Ceiling, ast.Cos,
1297 ast.CRC32, ast.Degrees, ast.Floor, ast.Ln, ast.Log, ast.Log2, ast.Log10, ast.Unhex,
1298 ast.Radians, ast.Rand, ast.Round, ast.Sign, ast.Sin, ast.Sqrt, ast.Tan, ast.SM3,
1299 ast.Quote, ast.RTrim, ast.ToBase64, ast.Trim, ast.Upper, ast.Ucase, ast.Hex,
1300 ast.BitLength, ast.CharLength, ast.Compress, ast.MD5, ast.SHA1, ast.SHA}
1301 args := []string{"2038330881", "'2038330881'", "'牵'", "-1", "''", "0"}
1302
1303 for _, f := range funcs {
1304 for _, a := range args {
1305 q := fmt.Sprintf("SELECT c1 from t1 where %s(%s)", f, a)
1306 tk.MustExec(`set tidb_enable_non_prepared_plan_cache=1`)
1307 r1 := tk.MustQuery(q)
1308 tk.MustExec(`set tidb_enable_non_prepared_plan_cache=0`)
1309 r2 := tk.MustQuery(q)
1310 r1.Sort().Check(r2.Sort().Rows())
1311 }
1312 }
1313}
1314
1315func TestWarningWithDisablePlanCacheStmt(t *testing.T) {
1316 store := testkit.CreateMockStore(t)

Callers

nothing calls this directly

Calls 7

MustExecMethod · 0.95
MustQueryMethod · 0.95
CreateMockStoreFunction · 0.92
NewTestKitFunction · 0.92
CheckMethod · 0.65
SortMethod · 0.65
RowsMethod · 0.65

Tested by

no test coverage detected