• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang tidb.Compile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/pingcap/tidb.Compile函数的典型用法代码示例。如果您正苦于以下问题:Golang Compile函数的具体用法?Golang Compile怎么用?Golang Compile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Compile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestShow

func (s *testStmtSuite) TestShow(c *C) {
	testSQL := `drop table if exists show_test; create table show_test (id int PRIMARY KEY AUTO_INCREMENT, c1 int, c2 int, c3 int default 1);`
	mustExec(c, s.testDB, testSQL)

	testSQL = "show columns from show_test;"
	stmtList, err := tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.ShowStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	testSQL = "show create table show_test;"
	stmtList, err = tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)
	testStmt, ok = stmtList[0].(*stmts.ShowStmt)
	c.Assert(ok, IsTrue)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	testSQL = "SHOW VARIABLES LIKE 'character_set_results';"
	stmtList, err = tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)
	testStmt, ok = stmtList[0].(*stmts.ShowStmt)
	c.Assert(ok, IsTrue)
	c.Assert(testStmt.Pattern, NotNil)
}
开发者ID:kevinhuo88888,项目名称:tidb,代码行数:34,代码来源:show_test.go


示例2: TestTableSourceString

func (s *testTableRsetSuite) TestTableSourceString(c *C) {
	tableIdent := table.Ident{Schema: model.NewCIStr(s.dbName), Name: model.NewCIStr(s.tableName)}
	ts := &rsets.TableSource{Source: tableIdent, Name: s.tableName}

	str := ts.String()
	c.Assert(len(str), Greater, 0)

	stmtList, err := tidb.Compile(s.querySql)
	c.Assert(err, IsNil)
	c.Assert(len(stmtList), Greater, 0)

	ts = &rsets.TableSource{Source: stmtList[0], Name: s.tableName}
	str = ts.String()
	c.Assert(len(str), Greater, 0)

	ts = &rsets.TableSource{Source: stmtList[0]}
	str = ts.String()
	c.Assert(len(str), Greater, 0)

	// check panic
	defer func() {
		e := recover()
		c.Assert(e, NotNil)
	}()

	ts = &rsets.TableSource{}
	str = ts.String()
}
开发者ID:ninefive,项目名称:tidb,代码行数:28,代码来源:from_test.go


示例3: TestSelectHaving

func (s *testStmtSuite) TestSelectHaving(c *C) {
	s.fillData(s.testDB, c)

	// Test compile
	stmtList, err := tidb.Compile("select * from test where id = 2;")
	c.Assert(err, IsNil)

	str := stmtList[0].OriginText()
	c.Assert(0, Less, len(str))

	tx := mustBegin(c, s.testDB)
	rows, err := tx.Query("select id, name from test where id in (1,3) having name like 'he%';")
	c.Assert(err, IsNil)

	for rows.Next() {
		var id int
		var name string
		rows.Scan(&id, &name)
		c.Assert(id, Equals, 1)
		c.Assert(name, Equals, "hello")
	}

	rows.Close()
	mustCommit(c, tx)
}
开发者ID:ninefive,项目名称:tidb,代码行数:25,代码来源:select_test.go


示例4: TestCreateTable

func (s *testStmtSuite) TestCreateTable(c *C) {
	stmtList, err := tidb.Compile(s.createDBSql + " CREATE TABLE if not exists test(id INT NOT NULL DEFAULT 1, name varchar(255), PRIMARY KEY(id));")
	c.Assert(err, IsNil)

	for _, stmt := range stmtList {
		c.Assert(len(stmt.OriginText()), Greater, 0)

		mf := newMockFormatter()
		stmt.Explain(nil, mf)
		c.Assert(mf.Len(), Greater, 0)
	}

	// Test create an exist database
	tx := mustBegin(c, s.testDB)
	_, err = tx.Exec(fmt.Sprintf("CREATE database %s;", s.dbName))
	c.Assert(err, NotNil)
	tx.Rollback()

	// Test create an exist table
	mustExec(c, s.testDB, "CREATE TABLE test(id INT NOT NULL DEFAULT 1, name varchar(255), PRIMARY KEY(id));")

	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec("CREATE TABLE test(id INT NOT NULL DEFAULT 1, name varchar(255), PRIMARY KEY(id));")
	c.Assert(err, NotNil)
	tx.Rollback()

	// Test "if not exist"
	mustExec(c, s.testDB, "CREATE TABLE if not exists test(id INT NOT NULL DEFAULT 1, name varchar(255), PRIMARY KEY(id));")
}
开发者ID:ninefive,项目名称:tidb,代码行数:29,代码来源:create_test.go


示例5: TestUse

func (s *testStmtSuite) TestUse(c *C) {
	testSQL := `create database if not exists use_test;`
	mustExec(c, s.testDB, testSQL)

	testSQL = `use test;`
	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.UseStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	errTestSQL := `use xxx;`
	tx := mustBegin(c, s.testDB)
	_, err = tx.Exec(errTestSQL)
	c.Assert(err, NotNil)
	tx.Rollback()
}
开发者ID:yzl11,项目名称:vessel,代码行数:25,代码来源:use_test.go


示例6: TestTableSourceString

func (s *testTableRsetSuite) TestTableSourceString(c *C) {
	tableIdent := table.Ident{Schema: model.NewCIStr(s.dbName), Name: model.NewCIStr(s.tableName)}
	ts := &rsets.TableSource{Source: tableIdent, Name: s.tableName}

	str := ts.String()
	c.Assert(len(str), Greater, 0)

	store := newStore(c)
	se := newSession(c, store, s.dbName)
	ctx, ok := se.(context.Context)
	c.Assert(ok, IsTrue)
	stmtList, err := tidb.Compile(ctx, s.querySql)
	c.Assert(err, IsNil)
	c.Assert(len(stmtList), Greater, 0)

	ts = &rsets.TableSource{Source: stmtList[0], Name: s.tableName}
	str = ts.String()
	c.Assert(len(str), Greater, 0)

	ts = &rsets.TableSource{Source: stmtList[0]}
	str = ts.String()
	c.Assert(len(str), Greater, 0)

	// check panic
	defer func() {
		e := recover()
		c.Assert(e, NotNil)
	}()

	ts = &rsets.TableSource{}
	str = ts.String()
}
开发者ID:lovedboy,项目名称:tidb,代码行数:32,代码来源:from_test.go


示例7: TestSetCharsetStmt

func (s *testStmtSuite) TestSetCharsetStmt(c *C) {
	testSQL := `SET NAMES utf8;`

	stmtList, err := tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.SetCharsetStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	ctx := mock.NewContext()
	variable.BindSessionVars(ctx)
	sessionVars := variable.GetSessionVars(ctx)
	for _, v := range variable.SetNamesVariables {
		c.Assert(sessionVars.Systems[v] != "utf8", IsTrue)
	}
	_, err = testStmt.Exec(ctx)
	c.Assert(err, IsNil)
	for _, v := range variable.SetNamesVariables {
		c.Assert(sessionVars.Systems[v], Equals, "utf8")
	}
	c.Assert(sessionVars.Systems[variable.CollationConnection], Equals, "utf8_general_ci")

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)
}
开发者ID:js-for-kids,项目名称:tidb,代码行数:30,代码来源:set_test.go


示例8: TestJoinRsetPlan

func (s *testJoinRsetSuite) TestJoinRsetPlan(c *C) {
	p, err := s.r.Plan(s.ctx)
	c.Assert(err, IsNil)

	_, ok := p.(*plans.JoinPlan)
	c.Assert(ok, IsTrue)

	// check join right is statement.
	querySql := fmt.Sprintf("select 1")
	stmtList, err := tidb.Compile(querySql)
	c.Assert(err, IsNil)
	c.Assert(len(stmtList), Greater, 0)

	ts := &rsets.TableSource{Source: stmtList[0]}
	s.r.Right = ts

	_, err = s.r.Plan(s.ctx)
	c.Assert(err, IsNil)

	// check join right is join rset.
	s.r.Right = &rsets.JoinRset{Left: ts}

	_, err = s.r.Plan(s.ctx)
	c.Assert(err, IsNil)

	// check error.
	s.r.Right = "xxx"
	_, err = s.r.Plan(s.ctx)
	c.Assert(err, NotNil)

	s.r.Right = nil
}
开发者ID:npk,项目名称:tidb,代码行数:32,代码来源:join_test.go


示例9: TestExplain

func (s *testStmtSuite) TestExplain(c *C) {
	testSQL := "explain select 1"

	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.ExplainStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	newTestSql := "explain " + testSQL
	newTestStmt := &stmts.ExplainStmt{S: testStmt, Text: newTestSql}

	mf := newMockFormatter()
	ctx := mock.NewContext()
	variable.BindSessionVars(ctx)
	newTestStmt.Explain(ctx, mf)
	c.Assert(mf.Len(), Greater, 0)

	_, err = testStmt.Exec(ctx)
	c.Assert(err, IsNil)

	showColumnSQL := "desc t;"

	stmtList, err = tidb.Compile(s.ctx, showColumnSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok = stmtList[0].(*stmts.ExplainStmt)
	c.Assert(ok, IsTrue)

	showStmt, ok := testStmt.S.(*stmts.ShowStmt)
	c.Assert(ok, IsTrue)

	// Mock DBName for ShowStmt
	showStmt.DBName = "test"

	mf = newMockFormatter()
	testStmt.Explain(ctx, mf)
	c.Assert(mf.Len(), Greater, 0)

	_, err = testStmt.Exec(ctx)
	c.Assert(err, IsNil)
}
开发者ID:lovedboy,项目名称:tidb,代码行数:47,代码来源:explain_test.go


示例10: TestDo

func (s *testStmtSuite) TestDo(c *C) {
	testSQL := "do 1, 2"

	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt := stmtList[0].(*stmts.DoStmt)
	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	mustExec(c, s.testDB, testSQL)
}
开发者ID:lovedboy,项目名称:tidb,代码行数:17,代码来源:do_test.go


示例11: TestRollback

func (s *testStmtSuite) TestRollback(c *C) {
	// Test RollbackStmt.
	testSQL := `rollback;`
	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.RollbackStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)
}
开发者ID:lovedboy,项目名称:tidb,代码行数:17,代码来源:transaction_test.go


示例12: TestDropDatabase

func (s *testStmtSuite) TestDropDatabase(c *C) {
	testSQL := "drop database if exists drop_test;"

	stmtList, err := tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.DropDatabaseStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsTrue)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	mustExec(c, s.testDB, testSQL)
}
开发者ID:caoyu0,项目名称:tidb,代码行数:19,代码来源:drop_test.go


示例13: TestCreateIndex

func (s *testStmtSuite) TestCreateIndex(c *C) {
	mustExec(c, s.testDB, s.createTableSql)
	stmtList, err := tidb.Compile("CREATE index name_idx on test (name)")
	c.Assert(err, IsNil)

	str := stmtList[0].OriginText()
	c.Assert(0, Less, len(str))

	mf := newMockFormatter()
	stmtList[0].Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	tx := mustBegin(c, s.testDB)
	_, err = tx.Exec("CREATE TABLE test(id INT NOT NULL DEFAULT 1, name varchar(255), PRIMARY KEY(id));")
	c.Assert(err, NotNil)
	tx.Rollback()

	// Test not exist
	mustExec(c, s.testDB, "CREATE index name_idx on test (name)")
}
开发者ID:ninefive,项目名称:tidb,代码行数:20,代码来源:create_test.go


示例14: TestSetCharsetStmt

func (s *testStmtSuite) TestSetCharsetStmt(c *C) {
	testSQL := `SET NAMES utf8;`

	stmtList, err := tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.SetCharsetStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	_, err = testStmt.Exec(nil)
	c.Assert(err, IsNil)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)
}
开发者ID:nengwang,项目名称:tidb,代码行数:20,代码来源:set_test.go


示例15: TestAlterTable

func (s *testStmtSuite) TestAlterTable(c *C) {
	testSQL := "drop table if exists t; create table t (c1 int); alter table t add column c2 int;"

	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)

	stmtLen := len(stmtList)
	c.Assert(stmtLen, Greater, 0)

	testStmt, ok := stmtList[stmtLen-1].(*stmts.AlterTableStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsTrue)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	mustExec(c, s.testDB, testSQL)
}
开发者ID:lovedboy,项目名称:tidb,代码行数:21,代码来源:altertable_test.go


示例16: TestDropTable

func (s *testStmtSuite) TestDropTable(c *C) {
	testSQL := "drop table if exists drop_table;"

	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.DropTableStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsTrue)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	mustExec(c, s.testDB, testSQL)
	mustExec(c, s.testDB, "create table if not exists t (c int)")
	mustExec(c, s.testDB, "drop table t")
}
开发者ID:hanjinze,项目名称:tidb,代码行数:21,代码来源:drop_test.go


示例17: TestTruncate

func (s *testStmtSuite) TestTruncate(c *C) {
	testSQL := `drop table if exists truncate_test; create table truncate_test(id int);`
	mustExec(c, s.testDB, testSQL)

	testSQL = "truncate table truncate_test;"
	stmtList, err := tidb.Compile(s.ctx, testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.TruncateTableStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	mustExec(c, s.testDB, testSQL)
}
开发者ID:lovedboy,项目名称:tidb,代码行数:21,代码来源:truncate_test.go


示例18: TestUnion

func (s *testStmtSuite) TestUnion(c *C) {
	testSQL := `select 1 union select 0;`
	mustExec(c, s.testDB, testSQL)

	stmtList, err := tidb.Compile(testSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.UnionStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	mf := newMockFormatter()
	testStmt.Explain(nil, mf)
	c.Assert(mf.Len(), Greater, 0)

	testSQL = `drop table if exists union_test; create table union_test(id int);
    insert union_test values (1),(2); select id from union_test union select 1;`
	mustExec(c, s.testDB, testSQL)

	testSQL = `select id from union_test union select id from union_test;`
	tx := mustBegin(c, s.testDB)
	rows, err := tx.Query(testSQL)
	c.Assert(err, IsNil)

	i := 1
	for rows.Next() {
		var id int
		rows.Scan(&id)
		c.Assert(id, Equals, i)

		i++
	}

	rows.Close()
	mustCommit(c, tx)
}
开发者ID:ninefive,项目名称:tidb,代码行数:39,代码来源:union_test.go


示例19: TestMultiTableDelete

func (s *testStmtSuite) TestMultiTableDelete(c *C) {
	s.fillDataMultiTable(s.testDB, c)

	// Test compile
	stmtList, err := tidb.Compile("DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.id=t2.id AND t2.id=t3.id;")
	c.Assert(err, IsNil)
	str := stmtList[0].OriginText()
	c.Assert(0, Less, len(str))

	r := mustExec(c, s.testDB, `DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.id=t2.id AND t2.id=t3.id;`)
	checkResult(c, r, 2, 0)

	// Select data
	tx := mustBegin(c, s.testDB)
	rows, err := tx.Query("select * from t3")
	c.Assert(err, IsNil)

	cnt := 0
	for rows.Next() {
		cnt++
	}
	c.Assert(cnt, Equals, 3)
	rows.Close()
}
开发者ID:nengwang,项目名称:tidb,代码行数:24,代码来源:delete_test.go


示例20: TestInsert

func (s *testStmtSuite) TestInsert(c *C) {
	testSQL := `drop table if exists insert_test;
    create table insert_test (id int PRIMARY KEY AUTO_INCREMENT, c1 int, c2 int, c3 int default 1);
    insert insert_test (c1) values (1),(2),(NULL);`
	mustExec(c, s.testDB, testSQL)

	errInsertSelectSQL := `insert insert_test (c1) values ();`
	tx := mustBegin(c, s.testDB)
	_, err := tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	errInsertSelectSQL = `insert insert_test (c1, c2) values (1,2),(1);`
	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	errInsertSelectSQL = `insert insert_test (xxx) values (3);`
	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	errInsertSelectSQL = `insert insert_test_xxx (c1) values ();`
	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	insertSetSQL := `insert insert_test set c1 = 3;`
	mustExec(c, s.testDB, insertSetSQL)

	stmtList, err := tidb.Compile(insertSetSQL)
	c.Assert(err, IsNil)
	c.Assert(stmtList, HasLen, 1)

	testStmt, ok := stmtList[0].(*stmts.InsertIntoStmt)
	c.Assert(ok, IsTrue)

	c.Assert(testStmt.IsDDL(), IsFalse)
	c.Assert(len(testStmt.OriginText()), Greater, 0)

	errInsertSelectSQL = `insert insert_test set c1 = 4, c1 = 5;`
	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	errInsertSelectSQL = `insert insert_test set xxx = 6;`
	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	insertSelectSQL := `create table insert_test_1 (id int, c1 int); insert insert_test_1 select id, c1 from insert_test;`
	mustExec(c, s.testDB, insertSelectSQL)

	insertSelectSQL = `create table insert_test_2 (id int, c1 int); 
	insert insert_test_1 select id, c1 from insert_test union select id * 10, c1 * 10 from insert_test;`
	mustExec(c, s.testDB, insertSelectSQL)

	errInsertSelectSQL = `insert insert_test_1 select c1 from insert_test;`
	tx = mustBegin(c, s.testDB)
	_, err = tx.Exec(errInsertSelectSQL)
	c.Assert(err, NotNil)
	tx.Rollback()

	insertSQL := `insert into insert_test (id, c2) values (1, 1) on duplicate key update c2=10;`
	mustExec(c, s.testDB, insertSQL)

	insertSQL = `insert into insert_test (id, c2) values (1, 1) on duplicate key update insert_test.c2=10;`
	mustExec(c, s.testDB, insertSQL)

	_, err = s.testDB.Exec(`insert into insert_test (id, c2) values(1, 1) on duplicate key update t.c2 = 10`)
	c.Assert(err, NotNil)
}
开发者ID:Brian110,项目名称:tidb,代码行数:77,代码来源:insert_test.go



注:本文中的github.com/pingcap/tidb.Compile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang tidb.CreateSession函数代码示例发布时间:2022-05-28
下一篇:
Golang util.ReadMessage函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap