Browse Source

fix bug on new engine

xormplus 8 years ago
parent
commit
fce0c12a8b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      xorm.go

+ 4 - 1
xorm.go

@@ -50,10 +50,13 @@ func close(engine *Engine) {
 	engine.Close()
 }
 
+func init() {
+	regDrvsNDialects()
+}
+
 // NewEngine new a db manager according to the parameter. Currently support four
 // drivers
 func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
-	regDrvsNDialects()
 	driver := core.QueryDriver(driverName)
 	if driver == nil {
 		return nil, fmt.Errorf("Unsupported driver name: %v", driverName)