(engine storepb.Engine, v []byte)
| 118 | } |
| 119 | |
| 120 | func escapeSQLString(engine storepb.Engine, v []byte) []byte { |
| 121 | switch engine { |
| 122 | case storepb.Engine_POSTGRES, storepb.Engine_REDSHIFT: |
| 123 | escapedStr := pq.QuoteLiteral(string(v)) |
| 124 | return []byte(escapedStr) |
| 125 | default: |
| 126 | result := []byte("'") |
| 127 | s := strconv.Quote(string(v)) |
| 128 | s = s[1 : len(s)-1] |
| 129 | s = strings.ReplaceAll(s, `'`, `''`) |
| 130 | result = append(result, []byte(s)...) |
| 131 | result = append(result, '\'') |
| 132 | return result |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func escapeSQLBytes(_ storepb.Engine, v []byte) []byte { |
| 137 | // Use hex encoding for all engines (SQL standard) |
no outgoing calls
no test coverage detected