数据库操作优化

This commit is contained in:
hoteas 2022-08-17 17:10:12 +08:00
parent 432d59d483
commit 125ccc5c3b

View File

@ -534,7 +534,7 @@ func (that *HoTimeDB) md5(query string, args ...interface{}) string {
func (that *HoTimeDB) Query(query string, args ...interface{}) []Map { func (that *HoTimeDB) Query(query string, args ...interface{}) []Map {
defer func() { defer func() {
if that.Mode == 2 { if that.Mode != 0 {
that.Log.Info("SQL:"+that.LastQuery, " DATA:", that.LastData, " ERROR:", that.LastErr.GetError()) that.Log.Info("SQL:"+that.LastQuery, " DATA:", that.LastData, " ERROR:", that.LastErr.GetError())
} }
}() }()
@ -582,7 +582,7 @@ func (that *HoTimeDB) Query(query string, args ...interface{}) []Map {
func (that *HoTimeDB) Exec(query string, args ...interface{}) (sql.Result, *Error) { func (that *HoTimeDB) Exec(query string, args ...interface{}) (sql.Result, *Error) {
defer func() { defer func() {
if that.Mode == 2 { if that.Mode != 0 {
that.Log.Info("SQL: "+that.LastQuery, " DATA: ", that.LastData, " ERROR: ", that.LastErr.GetError()) that.Log.Info("SQL: "+that.LastQuery, " DATA: ", that.LastData, " ERROR: ", that.LastErr.GetError())
} }
}() }()