fix: time-zone issue, localhost issue
This commit is contained in:
@@ -86,6 +86,7 @@ func InitDbClient(dbType, dbUser, dbPassword, dbHost, dbPort, dbName, dbParam st
|
||||
DbClient.dbConnMaxLifetime = 0
|
||||
DbClient.dbMaxIdleConns = 0
|
||||
DbClient.dbMaxOpenConns = 0
|
||||
|
||||
if log.GetLevel() == log.LOG_TRACE {
|
||||
DbClient.IsShowSQL = true
|
||||
}
|
||||
@@ -100,6 +101,8 @@ func InitDbClient(dbType, dbUser, dbPassword, dbHost, dbPort, dbName, dbParam st
|
||||
DbClient.XEngine.SetConnMaxLifetime(DbClient.dbConnMaxLifetime)
|
||||
DbClient.XEngine.SetMaxIdleConns(DbClient.dbMaxIdleConns)
|
||||
DbClient.XEngine.SetMaxOpenConns(DbClient.dbMaxOpenConns)
|
||||
DbClient.XEngine.DatabaseTZ = time.Local // 必须
|
||||
DbClient.XEngine.TZLocation = time.Local // 必须
|
||||
if DbClient.IsShowSQL {
|
||||
//DbClient.XEngine.SetLogger(&log.Elogger)
|
||||
DbClient.XEngine.ShowSQL(true)
|
||||
@@ -301,7 +304,7 @@ func ExtDatabaseGetData(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if s != "" {
|
||||
// err = XEngine.SQL(s).Find(&rows)
|
||||
if IsQuerySQL(s) == false {
|
||||
if !IsQuerySQL(s) {
|
||||
services.ResponseNotAcceptable406QuerySQLError(w)
|
||||
return
|
||||
}
|
||||
@@ -561,7 +564,7 @@ func DatabaseGetData(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("querySQL:", querySQL)
|
||||
rows, err = DbClient.XEngine.QueryInterface(querySQL)
|
||||
if err != nil {
|
||||
log.Error("SQL failed:", err)
|
||||
log.Error("QueryInterface failed:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user