|
|
@ -100,28 +100,23 @@ func format(query string, args ...interface{}) (string, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case '\'', '"', '`':
|
|
|
|
case '\'', '"', '`':
|
|
|
|
b.WriteByte(ch)
|
|
|
|
b.WriteByte(ch)
|
|
|
|
|
|
|
|
|
|
|
|
for j := i + 1; j < bytes; j++ {
|
|
|
|
for j := i + 1; j < bytes; j++ {
|
|
|
|
cur := query[j]
|
|
|
|
cur := query[j]
|
|
|
|
b.WriteByte(cur)
|
|
|
|
b.WriteByte(cur)
|
|
|
|
|
|
|
|
|
|
|
|
switch cur {
|
|
|
|
if cur == '\\' {
|
|
|
|
case '\\':
|
|
|
|
|
|
|
|
j++
|
|
|
|
j++
|
|
|
|
if j >= bytes {
|
|
|
|
if j >= bytes {
|
|
|
|
return "", errUnbalancedEscape
|
|
|
|
return "", errUnbalancedEscape
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.WriteByte(query[j])
|
|
|
|
b.WriteByte(query[j])
|
|
|
|
case '\'', '"', '`':
|
|
|
|
} else if cur == ch {
|
|
|
|
if cur == ch {
|
|
|
|
i = j
|
|
|
|
i = j
|
|
|
|
break
|
|
|
|
goto end
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
end:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
b.WriteByte(ch)
|
|
|
|
b.WriteByte(ch)
|
|
|
|
}
|
|
|
|
}
|
|
|
|