T-135: M2.3b — libs/data/questdb query layer for QuestDB 10.2.0: LATEST ON + parameterized PGWire queries + contract DDL for bars_1m / fx_1m / bar_revisions (pure, no live QuestDB)

This commit is contained in:
Studio 2026-12-01 06:26:06 -05:00
parent 35d5de815b
commit a67d9c1644
5 changed files with 232 additions and 40 deletions

View file

@ -92,6 +92,7 @@ export function rebaseWhereCondition(
if (ch === "'") {
out += ch;
i += 1;
let closed = false;
while (i < condition.length) {
const cur = condition.charAt(i);
out += cur;
@ -101,10 +102,14 @@ export function rebaseWhereCondition(
out += "'";
i += 1;
} else {
closed = true;
break;
}
}
}
if (!closed) {
throw new Error('Unterminated string literal in WHERE condition');
}
continue;
}
@ -112,6 +117,7 @@ export function rebaseWhereCondition(
if (ch === '"') {
out += ch;
i += 1;
let closed = false;
while (i < condition.length) {
const cur = condition.charAt(i);
out += cur;
@ -121,25 +127,34 @@ export function rebaseWhereCondition(
out += '"';
i += 1;
} else {
closed = true;
break;
}
}
}
if (!closed) {
throw new Error('Unterminated quoted identifier in WHERE condition');
}
continue;
}
// Line comment (-- ... \n)
// Line comment (-- ... \n); terminate at EOF so subsequent clauses are never swallowed
if (ch === '-' && next === '-') {
out += '--';
i += 2;
let sawNewline = false;
while (i < condition.length) {
const cur = condition.charAt(i);
out += cur;
i += 1;
if (cur === '\n') {
sawNewline = true;
break;
}
}
if (!sawNewline) {
out += '\n';
}
continue;
}
@ -147,15 +162,20 @@ export function rebaseWhereCondition(
if (ch === '/' && next === '*') {
out += '/*';
i += 2;
let closed = false;
while (i < condition.length) {
if (condition.charAt(i) === '*' && condition.charAt(i + 1) === '/') {
out += '*/';
i += 2;
closed = true;
break;
}
out += condition.charAt(i);
i += 1;
}
if (!closed) {
throw new Error('Unterminated block comment in WHERE condition');
}
continue;
}