Browse Source

fix mysql parsetime arg

pull/1440/head
Unknwon 10 years ago
parent
commit
81d01aa308
  1. 4
      models/models.go

4
models/models.go

@ -90,10 +90,10 @@ func getEngine() (*xorm.Engine, error) {
switch DbCfg.Type { switch DbCfg.Type {
case "mysql": case "mysql":
if DbCfg.Host[0] == '/' { // looks like a unix socket if DbCfg.Host[0] == '/' { // looks like a unix socket
cnnstr = fmt.Sprintf("%s:%s@unix(%s)/%s?charset=utf8", cnnstr = fmt.Sprintf("%s:%s@unix(%s)/%s?charset=utf8&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name) DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name)
} else { } else {
cnnstr = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8", cnnstr = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name) DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name)
} }
case "postgres": case "postgres":

Loading…
Cancel
Save