pscan: no need to store field-count fields

This commit is contained in:
Jeff Garzik
2019-01-05 10:29:41 -05:00
parent 663c02e791
commit faa138ed65

View File

@ -55,10 +55,9 @@ function parseRecordStream(recs)
name: current.name, name: current.name,
temp: current.temp, temp: current.temp,
if_n_exists: current.if_n_exists, if_n_exists: current.if_n_exists,
n_cols: current.n_cols,
columns: [], columns: [],
}; };
var wantCols = objTable.n_cols; var wantCols = current.n_cols;
while (wantCols-- > 0) { while (wantCols-- > 0) {
const col = stk.pop(); const col = stk.pop();
assert(col !== undefined); assert(col !== undefined);
@ -71,12 +70,11 @@ function parseRecordStream(recs)
var objTab = { var objTab = {
verb: 'DROP_TABLE', verb: 'DROP_TABLE',
temp: current.temp, temp: current.temp,
n_tables: current.n_tables,
if_exists: current.if_exists, if_exists: current.if_exists,
tables: [], tables: [],
}; };
var wantTabs = objTab.n_tables; var wantTabs = current.n_tables;
while (wantTabs-- > 0) { while (wantTabs-- > 0) {
const tab = stk.pop(); const tab = stk.pop();
assert(tab !== undefined); assert(tab !== undefined);
@ -90,12 +88,11 @@ function parseRecordStream(recs)
var objInsert = { var objInsert = {
verb: 'INSERT', verb: 'INSERT',
tbl_name: current.tbl_name, tbl_name: current.tbl_name,
n_vals: current.n_vals,
opts: current.opts, opts: current.opts,
values: [], values: [],
}; };
var wantVals = objInsert.n_vals; var wantVals = current.n_vals;
while (wantVals-- > 0) { while (wantVals-- > 0) {
const val = stk.pop(); const val = stk.pop();
assert(val !== undefined); assert(val !== undefined);
@ -125,19 +122,17 @@ function parseRecordStream(recs)
var objSelect = { var objSelect = {
verb: 'SELECT', verb: 'SELECT',
opts: current.opts, opts: current.opts,
n_expr: current.n_expr,
n_tbl_ref: current.n_tbl_ref,
tables: [], tables: [],
exprs: [], exprs: [],
}; };
var wantTabs = objSelect.n_tbl_ref; var wantTabs = current.n_tbl_ref;
while (wantTabs-- > 0) { while (wantTabs-- > 0) {
const tab = stk.pop(); const tab = stk.pop();
assert(tab !== undefined); assert(tab !== undefined);
objSelect.tables.push(tab.name); objSelect.tables.push(tab.name);
} }
var wantExpr = objSelect.n_expr; var wantExpr = current.n_expr;
while (wantExpr-- > 0) { while (wantExpr-- > 0) {
const an_expr = stk.pop(); const an_expr = stk.pop();
assert(an_expr !== undefined); assert(an_expr !== undefined);