Skip to content
New issue

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

dtmimp.DBExec需要返回数据ID #501

Open
shangpingjian opened this issue Apr 15, 2024 · 1 comment
Open

dtmimp.DBExec需要返回数据ID #501

shangpingjian opened this issue Apr 15, 2024 · 1 comment

Comments

@shangpingjian
Copy link

// 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返回来

@yedf2
Copy link
Contributor

yedf2 commented May 4, 2024

这个是dtm内部使用的,并不是通用的SQL API,不需要返回数据ID。如果你需要返回数据ID,可以自己写相关的函数,自己调用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants