Skip to content

Commit

Permalink
Fix SQL quoting (go-gitea#5137)
Browse files Browse the repository at this point in the history
`show` is keyword in MySQL and has to be quoted to reference a column name. Use grave accents (ASCII code 96) for quoting to match rest of the source code. It's non-standard SQL, but it's supported by SQLite and MySQL.

Signed-off-by: Filip Navara <navara@emclient.com>
  • Loading branch information
filipnavara authored and techknowlogick committed Oct 22, 2018
1 parent 49d666f commit 7238bb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/user_openid.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func DeleteUserOpenID(openid *UserOpenID) (err error) {

// ToggleUserOpenIDVisibility toggles visibility of an openid address of given user.
func ToggleUserOpenIDVisibility(id int64) (err error) {
_, err = x.Exec("update user_open_id set show = not show where id = ?", id)
_, err = x.Exec("update `user_open_id` set `show` = not `show` where `id` = ?", id)
return err
}

Expand Down

0 comments on commit 7238bb3

Please sign in to comment.