use coalesce rather than notes directly

This commit is contained in:
Morgan Bazalgette 2017-12-08 15:40:45 +01:00
parent 0cb01f6067
commit 982b9ab9f8
No known key found for this signature in database
GPG Key ID: 40D328300D245DA5

View File

@ -193,7 +193,7 @@ func rapLog(md common.MethodData, message string) {
func appendToUserNotes(md common.MethodData, message string, user int) { func appendToUserNotes(md common.MethodData, message string, user int) {
message = "\n[" + time.Now().Format("2006-01-02 15:04:05") + "] API: " + message message = "\n[" + time.Now().Format("2006-01-02 15:04:05") + "] API: " + message
_, err := md.DB.Exec("UPDATE users SET notes = CONCAT(notes, ?) WHERE id = ?", _, err := md.DB.Exec("UPDATE users SET notes = CONCAT(COALESCE(notes, ''), ?) WHERE id = ?",
message, user) message, user)
if err != nil { if err != nil {
md.Err(err) md.Err(err)