Skip to content

Commit

Permalink
Merge pull request #13 from astaxie/master
Browse files Browse the repository at this point in the history
init stores when declare
  • Loading branch information
coocood committed Sep 6, 2015
2 parents 22d537c + cbe4881 commit 02d35dd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ var (
domap = &domainMap{
domains: map[string]*domain.Domain{},
}
stores = make(map[string]kv.Driver)
)

// Compile is safe for concurrent use by multiple goroutines.
Expand Down Expand Up @@ -193,8 +194,6 @@ func runPreparedStmt(ctx context.Context, ps *stmts.PreparedStmt) (rset.Recordse
return rs, errors.Trace(err)
}

var stores map[string]kv.Driver

// RegisterStore registers a kv storage with unique name and its associated Driver.
func RegisterStore(name string, driver kv.Driver) error {
name = strings.ToLower(name)
Expand Down Expand Up @@ -251,7 +250,6 @@ func IsQuery(sql string) bool {
}

func init() {
stores = make(map[string]kv.Driver)
// Register default memory and goleveldb storage
RegisterLocalStore("memory", goleveldb.MemoryDriver{})
RegisterLocalStore("goleveldb", goleveldb.Driver{})
Expand Down

0 comments on commit 02d35dd

Please sign in to comment.