You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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
gorm version
v1.20.1
// Exec execute raw sql
func (db *DB) Exec(sql string, values ...interface{}) (tx *DB)
In the
Exec
function, if the
sql
parameter contains
@,?
characters, etc., and the
values
parameter is not passed in, the Exec function executes an error.
example:
query := `UPDATE "1_buffer_data" SET value = '@1Condition?' WHERE "id" = '1';`
err := DBConn.Debug().Exec(query).Error
if err != nil {
return err
// Output:
// runtime error: index out of range [0] with length 0