zeroshade commented on code in PR #2254:
URL: https://github.com/apache/arrow-adbc/pull/2254#discussion_r1801509063
##########
go/adbc/driver/snowflake/connection.go:
##########
@@ -73,9 +73,51 @@ type connectionImpl struct {
useHighPrecision bool
}
+func escapeSingleQuoteForLike(arg string) string {
+ if len(arg) == 0 {
+ return arg
+ }
+
+ idx := strings.IndexByte(arg, '\'')
+ if idx == -1 {
+ return arg
+ }
+
+ var b strings.Builder
+ b.Grow(len(arg))
+
+ for {
+ before, after, found := strings.Cut(arg, `'`)
+ b.WriteString(before)
+ if !found {
+ return b.String()
+ }
+
+ if before[len(before)-1] != '\\' {
+ b.WriteByte('\\')
+ }
Review Comment:
Yea, this is intended to handle pre-escaped characters. The logic is taken
from snowflake's JDBC driver, I figured handling one level of escaping was
sufficient given our current spec. :smile:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]