Skip to content

Commit aed6b36

Browse files
committed
quote and escape unquoted system parameters
1 parent 2a6c607 commit aed6b36

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

connection.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ func (mc *mysqlConn) handleParams() (err error) {
5252

5353
// System Vars
5454
default:
55-
err = mc.exec("SET " + param + "=" + val + "")
55+
if val[0] == '\'' || val[0] == '"' {
56+
err = mc.exec("SET " + param + "=" + val)
57+
} else {
58+
query := "SET " + param + "='" + string(escapeStringBackslash(nil, val)) + "'"
59+
err = mc.exec(query)
60+
}
5661
if err != nil {
5762
return
5863
}

0 commit comments

Comments
 (0)