mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
修改集群bug
数据库模块空指针问题
This commit is contained in:
@@ -283,6 +283,11 @@ func (slf *DBModule) SyncQuery(query string, args ...interface{}) SyncDBResult {
|
||||
// Exec ...
|
||||
func (slf *DBModule) Exec(query string, args ...interface{}) DBResult {
|
||||
ret := DBResult{}
|
||||
if slf.db == nil {
|
||||
ret.Err = fmt.Errorf("cannot connect database!")
|
||||
return ret
|
||||
}
|
||||
|
||||
res, err := slf.db.Exec(query, args...)
|
||||
ret.Err = err
|
||||
ret.LastInsertID, _ = res.LastInsertId()
|
||||
|
||||
Reference in New Issue
Block a user