remove the dependence between tables and table

As tables is the implement of table. So tables like the drivers, while
table like database/sql. while drivers need to regiester in the init.
This commit is contained in:
astaxie
2015-09-07 19:03:49 +08:00
parent 222ea14314
commit 262082babc
5 changed files with 5 additions and 11 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/pingcap/tidb/meta/autoid"
"github.com/pingcap/tidb/model"
"github.com/pingcap/tidb/table"
_ "github.com/pingcap/tidb/table/tables"
)
// InfoSchema is the interface used to retrieve the schema information.

View File

@ -22,8 +22,6 @@ import (
"github.com/pingcap/tidb/mysqldef"
"github.com/pingcap/tidb/store/localstore"
"github.com/pingcap/tidb/store/localstore/goleveldb"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/table/tables"
"github.com/pingcap/tidb/util/types"
)
@ -37,8 +35,6 @@ type testSuite struct {
}
func (*testSuite) TestT(c *C) {
table.TableFromMeta = tables.TableFromMeta
driver := localstore.Driver{Driver: goleveldb.MemoryDriver{}}
store, err := driver.Open("memory")
c.Assert(err, IsNil)

View File

@ -570,3 +570,7 @@ func (t *Table) IterRecords(ctx context.Context, startKey string, cols []*column
func (t *Table) AllocAutoID() (int64, error) {
return t.alloc.Alloc(t.ID)
}
func init() {
table.TableFromMeta = TableFromMeta
}

View File

@ -25,8 +25,6 @@ import (
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/store/localstore"
"github.com/pingcap/tidb/store/localstore/goleveldb"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/table/tables"
)
func TestT(t *testing.T) {
@ -41,7 +39,6 @@ type testSuite struct {
}
func (ts *testSuite) SetUpSuite(c *C) {
table.TableFromMeta = tables.TableFromMeta
driver := localstore.Driver{Driver: goleveldb.MemoryDriver{}}
store, err := driver.Open("memory")
c.Check(err, IsNil)

View File

@ -37,8 +37,6 @@ import (
"github.com/pingcap/tidb/store/localstore/boltdb"
"github.com/pingcap/tidb/store/localstore/engine"
"github.com/pingcap/tidb/store/localstore/goleveldb"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/table/tables"
)
// Engine prefix name
@ -259,8 +257,6 @@ func init() {
RegisterLocalStore("goleveldb", goleveldb.Driver{})
RegisterLocalStore("boltdb", boltdb.Driver{})
table.TableFromMeta = tables.TableFromMeta
// start pprof handlers
if Debug {
go http.ListenAndServe(PprofAddr, nil)