mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 15:04:45 +08:00
Merge branch 'master' of https://github.com/duanhf2012/origin
This commit is contained in:
@@ -284,6 +284,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