Exemple #1
0
func (*testSuite) TestT(c *C) {
	var ident = table.Ident{
		Name: model.NewCIStr("t"),
	}
	c.Assert(ident.String(), Not(Equals), "")
	driver := localstore.Driver{Driver: goleveldb.MemoryDriver{}}
	store, err := driver.Open("memory")
	c.Assert(err, IsNil)
	se, err := tidb.CreateSession(store)
	c.Assert(err, IsNil)
	ctx := se.(context.Context)
	db.BindCurrentSchema(ctx, "test")
	fullIdent := ident.Full(ctx)
	c.Assert(fullIdent.Schema.L, Equals, "test")
	c.Assert(fullIdent.Name.L, Equals, "t")
	c.Assert(fullIdent.String(), Not(Equals), "")
	fullIdent2 := fullIdent.Full(ctx)
	c.Assert(fullIdent2.Schema.L, Equals, fullIdent.Schema.L)
}
Exemple #2
0
func getTable(ctx context.Context, tableIdent table.Ident) (table.Table, error) {
	full := tableIdent.Full(ctx)
	return sessionctx.GetDomain(ctx).InfoSchema().TableByName(full.Schema, full.Name)
}