Commit cc25a9a
committed
better handle sql queries with invalid encoding
Following the same strategy as
rails/rails@8cf09b7.
```
If the SQL encoding somehow is invalid, `Regexp#match?` raises
`ArgumentError`.
Best we can do is to copy the string and try to match
the regexp in "binary" mode.
```
After this change ActiveRecord::StatementInvalid is raised. Quoting
[Rails Postgresql
test](rails/rails@8cf09b7#diff-39aac151bf5772be2c6c4fec49bf5cdf5a21ca816fe181ef01466ecd941bef9bR56)
```
At least we can assert it fails in the client and not before when trying
to match the query.
```1 parent 946dc6b commit cc25a9a
File tree
3 files changed
+15
-0
lines changed- lib/active_record/connection_adapters/sqlserver
- test/cases
3 files changed
+15
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
| |||
0 commit comments