Skip to content

Commit

Permalink
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 10 additions & 0 deletions executor/prepared_test.go
Original file line number Diff line number Diff line change
@@ -77,6 +77,16 @@ func (s *testSuite) TestPrepared(c *C) {
c.Assert(err, IsNil)
c.Assert(stmt.OriginText(), Equals, query)

// Check that rebuild plan works.
tk.Se.PrepareTxnCtx(goctx.Background())
err = stmt.RebuildPlan()
c.Assert(err, IsNil)
rs, err := stmt.Exec(goctx.Background())
c.Assert(err, IsNil)
_, err = rs.Next(goctx.Background())
c.Assert(err, IsNil)
c.Assert(rs.Close(), IsNil)

// Make schema change.
tk.MustExec("drop table if exists prepare2")
tk.Exec("create table prepare2 (a int)")
11 changes: 5 additions & 6 deletions new_session_test.go
Original file line number Diff line number Diff line change
@@ -1443,12 +1443,11 @@ func (s *testSchemaSuite) TestPrepareStmtCommitWhenSchemaChanged(c *C) {
tk1.MustExec("execute stmt using @a, @a")
tk1.MustExec("commit")

// TODO: PrepareStmt should handle this.
//tk1.MustExec("begin")
//tk.MustExec("alter table t drop column b")
//tk1.MustExec("execute stmt using @a, @a")
//_, err := tk1.Exec("commit")
//c.Assert(terror.ErrorEqual(err, executor.ErrWrongValueCountOnRow), IsTrue, Commentf("err %v", err))
tk1.MustExec("begin")
tk.MustExec("alter table t drop column b")
tk1.MustExec("execute stmt using @a, @a")
_, err := tk1.Exec("commit")
c.Assert(terror.ErrorEqual(err, executor.ErrWrongValueCountOnRow), IsTrue, Commentf("err %v", err))
}

func (s *testSchemaSuite) TestCommitWhenSchemaChanged(c *C) {

0 comments on commit f3d2a62

Please sign in to comment.