(t *testing.T)
| 296 | } |
| 297 | |
| 298 | func TestIssue38533(t *testing.T) { |
| 299 | store := testkit.CreateMockStore(t) |
| 300 | tk := testkit.NewTestKit(t, store) |
| 301 | tk.MustExec("use test") |
| 302 | tk.MustExec("create table t (a int, key (a))") |
| 303 | tk.MustExec(`prepare st from "select /*+ use_index(t, a) */ a from t where a=? and a=?"`) |
| 304 | tk.MustExec(`set @a=1`) |
| 305 | tk.MustExec(`execute st using @a, @a`) |
| 306 | tkProcess := tk.Session().ShowProcess() |
| 307 | ps := []*util.ProcessInfo{tkProcess} |
| 308 | tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) |
| 309 | plan := tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Rows() |
| 310 | require.True(t, strings.Contains(plan[1][0].(string), "RangeScan")) // range-scan instead of full-scan |
| 311 | |
| 312 | tk.MustExec(`execute st using @a, @a`) |
| 313 | tk.MustExec(`execute st using @a, @a`) |
| 314 | tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) |
| 315 | } |
| 316 | |
| 317 | func TestInvalidRange(t *testing.T) { |
| 318 | store := testkit.CreateMockStore(t) |
nothing calls this directly
no test coverage detected