diff options
| author | 2021-12-18 22:27:52 +0100 | |
|---|---|---|
| committer | 2021-12-18 22:46:40 +0100 | |
| commit | 5f6c974cbc4f455b46923340d1ca97d375bcbfe5 (patch) | |
| tree | 19348ee5c5d508e84db89e14ec707452a655d8b1 | |
| parent | add a test for bind markers inside strings (diff) | |
| download | zig-sqlite-5f6c974cbc4f455b46923340d1ca97d375bcbfe5.tar.gz zig-sqlite-5f6c974cbc4f455b46923340d1ca97d375bcbfe5.tar.xz zig-sqlite-5f6c974cbc4f455b46923340d1ca97d375bcbfe5.zip | |
improve query parsing to ignore bind markers prefix inside strings
Fixes #65
Diffstat (limited to '')
| -rw-r--r-- | query.zig | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -63,6 +63,22 @@ pub const ParsedQuery = struct { | |||
| 63 | buf[pos] = c; | 63 | buf[pos] = c; |
| 64 | pos += 1; | 64 | pos += 1; |
| 65 | }, | 65 | }, |
| 66 | '\'', '"' => { | ||
| 67 | state = .InsideString; | ||
| 68 | buf[pos] = c; | ||
| 69 | pos += 1; | ||
| 70 | }, | ||
| 71 | else => { | ||
| 72 | buf[pos] = c; | ||
| 73 | pos += 1; | ||
| 74 | }, | ||
| 75 | }, | ||
| 76 | .InsideString => switch (c) { | ||
| 77 | '\'', '"' => { | ||
| 78 | state = .Start; | ||
| 79 | buf[pos] = c; | ||
| 80 | pos += 1; | ||
| 81 | }, | ||
| 66 | else => { | 82 | else => { |
| 67 | buf[pos] = c; | 83 | buf[pos] = c; |
| 68 | pos += 1; | 84 | pos += 1; |