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

Function sqlv_read_literal

internal/cbm/sql_values.c:262–280  ·  view source on GitHub ↗

Consume one value if it is a plain literal. Never consumes a parenthesis, so * on false the caller can still find the tuple's end from the cursor. */

Source from the content-addressed store, hash-verified

260/* Consume one value if it is a plain literal. Never consumes a parenthesis, so
261 * on false the caller can still find the tuple's end from the cursor. */
262static bool sqlv_read_literal(sqlv_scan_t *sc) {
263 char c = sqlv_at(sc, 0);
264 char n = sqlv_at(sc, 1);
265 if (c == '\'') {
266 return sqlv_read_string(sc);
267 }
268 if ((c == '-' || c == '+') &&
269 (isdigit((unsigned char)n) || (n == '.' && isdigit((unsigned char)sqlv_at(sc, 2))))) {
270 sqlv_step(sc);
271 return sqlv_read_number(sc);
272 }
273 if (isdigit((unsigned char)c) || (c == '.' && isdigit((unsigned char)n))) {
274 return sqlv_read_number(sc);
275 }
276 if (isalpha((unsigned char)c) || c == '_') {
277 return sqlv_read_word_literal(sc);
278 }
279 return false;
280}
281
282/* Consume one tuple starting at its '('. *literal says whether every value in
283 * it was a plain literal. Returns false if the tuple never closes. */

Callers 1

sqlv_scan_tupleFunction · 0.85

Calls 5

sqlv_atFunction · 0.85
sqlv_read_stringFunction · 0.85
sqlv_stepFunction · 0.85
sqlv_read_numberFunction · 0.85
sqlv_read_word_literalFunction · 0.85

Tested by

no test coverage detected