We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// DBExec use raw db to exec func DBExec(dbType string, db DB, sql string, values ...interface{}) (affected int64, rerr error) { if sql == "" { return 0, nil } began := time.Now() sql = GetDBSpecial(dbType).GetPlaceHoldSQL(sql) r, rerr := db.Exec(sql, values...) used := time.Since(began) / time.Millisecond if rerr == nil { affected, rerr = r.RowsAffected() logger.Debugf("used: %d ms affected: %d for %s %v", used, affected, sql, values) } else { logger.Errorf("used: %d ms exec error: %v for %s %v", used, rerr, sql, values) } return }
执行insert语句 需要把数据ID返回来
The text was updated successfully, but these errors were encountered:
这个是dtm内部使用的,并不是通用的SQL API,不需要返回数据ID。如果你需要返回数据ID,可以自己写相关的函数,自己调用
Sorry, something went wrong.
No branches or pull requests
// DBExec use raw db to exec
func DBExec(dbType string, db DB, sql string, values ...interface{}) (affected int64, rerr error) {
if sql == "" {
return 0, nil
}
began := time.Now()
sql = GetDBSpecial(dbType).GetPlaceHoldSQL(sql)
r, rerr := db.Exec(sql, values...)
used := time.Since(began) / time.Millisecond
if rerr == nil {
affected, rerr = r.RowsAffected()
logger.Debugf("used: %d ms affected: %d for %s %v", used, affected, sql, values)
} else {
logger.Errorf("used: %d ms exec error: %v for %s %v", used, rerr, sql, values)
}
return
}
执行insert语句 需要把数据ID返回来
The text was updated successfully, but these errors were encountered: