MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sqlv_skip_quoted

Function sqlv_skip_quoted

internal/cbm/sql_values.c:68–90  ·  view source on GitHub ↗

Consume a '..', "..", or `..` run starting at the opening quote. Doubled * quotes escape everywhere; a backslash escapes in strings and "..". Sets * *raw_newline when the run crosses a line break. False if it never closes. */

Source from the content-addressed store, hash-verified

66 * quotes escape everywhere; a backslash escapes in strings and "..". Sets
67 * *raw_newline when the run crosses a line break. False if it never closes. */
68static bool sqlv_skip_quoted(sqlv_scan_t *sc, bool *raw_newline) {
69 char q = sc->s[sc->i];
70 sqlv_step(sc);
71 while (sc->i < sc->len) {
72 char c = sc->s[sc->i];
73 if (c == '\n') {
74 *raw_newline = true;
75 }
76 if (c == '\\' && q != '`' && sc->i + 1 < sc->len) {
77 sqlv_step(sc);
78 sqlv_step(sc);
79 continue;
80 }
81 sqlv_step(sc);
82 if (c == q) {
83 if (sqlv_at(sc, 0) != q) {
84 return true;
85 }
86 sqlv_step(sc); /* doubled quote: an escaped quote character */
87 }
88 }
89 return false;
90}
91
92/* $tag$ ... $tag$ (PostgreSQL). Returns false, consuming nothing, when the `$`
93 * does not open a dollar quote ($1 parameters, a lone $). */

Callers 2

sqlv_skip_any_quotedFunction · 0.85
sqlv_read_stringFunction · 0.85

Calls 2

sqlv_stepFunction · 0.85
sqlv_atFunction · 0.85

Tested by

no test coverage detected