@minnowdb/core 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/block-format/block.js +254 -325
- package/dist/block-format/checksum.js +30 -52
- package/dist/block-format/codecs.js +112 -125
- package/dist/block-format/column.js +187 -205
- package/dist/block-format/index.js +5 -1
- package/dist/block-format/physical.js +371 -387
- package/dist/block-format/types.js +4 -1
- package/dist/block-format/unicode.js +30 -39
- package/dist/date-value.js +67 -78
- package/dist/engine/artifact-cache.js +106 -116
- package/dist/engine/batch.js +36 -44
- package/dist/engine/buffered-writer.js +156 -158
- package/dist/engine/byte-estimates.js +20 -22
- package/dist/engine/cache-limits.js +24 -25
- package/dist/engine/cancellation.js +5 -3
- package/dist/engine/catalog.js +64 -73
- package/dist/engine/client.js +715 -780
- package/dist/engine/database.js +15941 -19313
- package/dist/engine/defaults.js +104 -111
- package/dist/engine/errors.js +113 -128
- package/dist/engine/fts.js +233 -280
- package/dist/engine/group-index.js +287 -321
- package/dist/engine/index.js +23 -12
- package/dist/engine/join-index.js +177 -186
- package/dist/engine/keyed-live.js +168 -173
- package/dist/engine/live-api.js +0 -1
- package/dist/engine/live-equal.js +32 -37
- package/dist/engine/live.js +603 -647
- package/dist/engine/memory.js +109 -111
- package/dist/engine/optimizer.d.ts +19 -1
- package/dist/engine/optimizer.js +2633 -2934
- package/dist/engine/point-read.js +122 -182
- package/dist/engine/query-api.js +12 -3
- package/dist/engine/query-cache.js +61 -69
- package/dist/engine/query.d.ts +6 -0
- package/dist/engine/query.js +8503 -9980
- package/dist/engine/result-wire.js +221 -252
- package/dist/engine/schema-wire.js +97 -112
- package/dist/engine/schema.js +1099 -1254
- package/dist/engine/sort-keys.js +315 -389
- package/dist/engine/sql-domains.js +646 -769
- package/dist/engine/sql-driver.js +0 -1
- package/dist/engine/sql-functions.js +1031 -1125
- package/dist/engine/sql-json.js +199 -218
- package/dist/engine/sql-semantics.js +572 -639
- package/dist/engine/typed-live.js +271 -293
- package/dist/engine/vector.js +4484 -5145
- package/dist/engine/worker-host.d.ts +8 -63
- package/dist/engine/worker-host.js +28 -1130
- package/dist/engine/worker-indexeddb.d.ts +1 -0
- package/dist/engine/worker-indexeddb.js +3 -0
- package/dist/engine/worker-memory.d.ts +1 -0
- package/dist/engine/worker-memory.js +3 -0
- package/dist/engine/worker-opfs.d.ts +1 -0
- package/dist/engine/worker-opfs.js +3 -0
- package/dist/engine/worker-server.d.ts +93 -0
- package/dist/engine/worker-server.js +999 -0
- package/dist/engine/worker-store-indexeddb.d.ts +2 -0
- package/dist/engine/worker-store-indexeddb.js +11 -0
- package/dist/engine/worker-store-memory.d.ts +2 -0
- package/dist/engine/worker-store-memory.js +6 -0
- package/dist/engine/worker-store-opfs.d.ts +2 -0
- package/dist/engine/worker-store-opfs.js +9 -0
- package/dist/engine/worker.js +0 -12
- package/dist/engine/write-block-planner.js +93 -100
- package/dist/plan/index.js +15 -16
- package/dist/plan/model.d.ts +6 -0
- package/dist/plan/model.js +20 -27
- package/dist/storage/index.js +0 -12
- package/dist/storage/indexeddb.js +11776 -13171
- package/dist/storage/memory.js +1198 -1241
- package/dist/storage/opfs/files.js +238 -295
- package/dist/storage/opfs/index.js +9 -3
- package/dist/storage/opfs/leader.js +4386 -4856
- package/dist/storage/opfs/rpc.js +223 -259
- package/dist/storage/opfs/snapshot-ledger.js +219 -260
- package/dist/storage/opfs/store.js +884 -1003
- package/dist/storage/persistence.js +59 -74
- package/dist/storage/snapshot-stream.js +788 -826
- package/dist/storage/snapshot.js +36 -37
- package/dist/storage/toolkit/extents.js +444 -520
- package/dist/storage/toolkit/index.js +28 -29
- package/dist/storage/toolkit/record-core.js +5792 -6377
- package/dist/storage/toolkit/sync-file.js +34 -42
- package/dist/storage/toolkit/wal.js +92 -127
- package/dist/storage/toolkit/wire.js +232 -256
- package/dist/storage/types.js +2948 -3250
- package/dist/testing/block-store-conformance.js +1556 -1629
- package/dist/testing/index.js +310 -291
- package/dist/testing/opfs-shim.js +280 -312
- package/dist/testing/simulator.js +496 -534
- package/dist/testing/sqllogictest.js +425 -365
- package/dist/transactions/index.js +1464 -1712
- package/dist/worker-protocol/index.js +70 -69
- package/package.json +20 -2
|
@@ -1,280 +1,249 @@
|
|
|
1
1
|
import { dateMilliseconds } from "../date-value.js";
|
|
2
2
|
import { unknownColumnDomains } from "./query.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
function encodeQueryResult(result) {
|
|
4
|
+
return encodeRows(result.columns, result.rows, result.columnDomains);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export function encodeQueryRows(rows) {
|
|
11
|
-
const first = rows[0];
|
|
12
|
-
const columns = first === undefined ? [] : Object.keys(first);
|
|
13
|
-
return encodeRows(columns, rows, unknownColumnDomains(columns));
|
|
6
|
+
function encodeQueryRows(rows) {
|
|
7
|
+
const first = rows[0];
|
|
8
|
+
const columns = first === void 0 ? [] : Object.keys(first);
|
|
9
|
+
return encodeRows(columns, rows, unknownColumnDomains(columns));
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
return { columns, columnDomains, rows };
|
|
11
|
+
function decodeQueryResult(payload) {
|
|
12
|
+
if (!isWireQueryResult(payload)) {
|
|
13
|
+
throw new TypeError("Expected a columnar query result frame");
|
|
14
|
+
}
|
|
15
|
+
const columns = [...payload.columns];
|
|
16
|
+
if (payload.values.length !== columns.length || payload.columnDomains.length !== columns.length) {
|
|
17
|
+
throw new TypeError("Columnar result frame metadata is not aligned");
|
|
18
|
+
}
|
|
19
|
+
const columnDomains = structuredClone(payload.columnDomains);
|
|
20
|
+
const rows = [];
|
|
21
|
+
for (let index = 0; index < payload.rowCount; index += 1)
|
|
22
|
+
rows.push({});
|
|
23
|
+
for (const [position, name] of columns.entries()) {
|
|
24
|
+
const column = payload.values[position];
|
|
25
|
+
if (column === void 0)
|
|
26
|
+
throw new TypeError("Columnar result frame is missing a column");
|
|
27
|
+
fillColumn(rows, name, column);
|
|
28
|
+
}
|
|
29
|
+
return { columns, columnDomains, rows };
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
value !== null &&
|
|
40
|
-
value.kind === "columnar-result" &&
|
|
41
|
-
Array.isArray(value.columns) &&
|
|
42
|
-
Array.isArray(value.columnDomains) &&
|
|
43
|
-
Array.isArray(value.values) &&
|
|
44
|
-
typeof value.rowCount === "number");
|
|
31
|
+
function isWireQueryResult(value) {
|
|
32
|
+
return typeof value === "object" && value !== null && value.kind === "columnar-result" && Array.isArray(value.columns) && Array.isArray(value.columnDomains) && Array.isArray(value.values) && typeof value.rowCount === "number";
|
|
45
33
|
}
|
|
46
34
|
function encodeRows(columns, rows, columnDomains) {
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
if (columnDomains.length !== columns.length) {
|
|
36
|
+
throw new TypeError("Query result column domains must align with the result columns");
|
|
37
|
+
}
|
|
38
|
+
const transfer = [];
|
|
39
|
+
const values = columns.map((name) => {
|
|
40
|
+
const column = encodeColumn(name, rows);
|
|
41
|
+
if (column.kind === "number" || column.kind === "boolean" || column.kind === "datetime") {
|
|
42
|
+
transfer.push(column.values.buffer);
|
|
43
|
+
if (column.nulls !== void 0)
|
|
44
|
+
transfer.push(column.nulls.buffer);
|
|
45
|
+
} else if (column.kind === "string") {
|
|
46
|
+
transfer.push(column.offsets.buffer);
|
|
47
|
+
if (column.nulls !== void 0)
|
|
48
|
+
transfer.push(column.nulls.buffer);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return column;
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
payload: {
|
|
67
|
-
kind: "columnar-result",
|
|
68
|
-
columns: [...columns],
|
|
69
|
-
columnDomains: structuredClone([...columnDomains]),
|
|
70
|
-
rowCount: rows.length,
|
|
71
|
-
values,
|
|
72
|
-
},
|
|
73
|
-
transfer,
|
|
74
|
-
};
|
|
50
|
+
return column;
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
payload: {
|
|
54
|
+
kind: "columnar-result",
|
|
55
|
+
columns: [...columns],
|
|
56
|
+
columnDomains: structuredClone([...columnDomains]),
|
|
57
|
+
rowCount: rows.length,
|
|
58
|
+
values
|
|
59
|
+
},
|
|
60
|
+
transfer
|
|
61
|
+
};
|
|
75
62
|
}
|
|
76
|
-
/**
|
|
77
|
-
* The first non-null value picks the column's typed form; a later value of another type demotes
|
|
78
|
-
* the whole column to the mixed form, which is rare enough to restart from scratch rather than
|
|
79
|
-
* to plan for.
|
|
80
|
-
*/
|
|
81
63
|
function encodeColumn(name, rows) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return encodeMixed(name, rows);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return nulls === undefined ? { kind: "number", values } : { kind: "number", values, nulls };
|
|
64
|
+
const rowCount = rows.length;
|
|
65
|
+
let start = 0;
|
|
66
|
+
while (start < rowCount && (rows[start]?.[name] ?? null) === null)
|
|
67
|
+
start += 1;
|
|
68
|
+
const first = rows[start]?.[name] ?? null;
|
|
69
|
+
if (first === null)
|
|
70
|
+
return { kind: "null" };
|
|
71
|
+
if (typeof first === "number") {
|
|
72
|
+
const values = new Float64Array(rowCount);
|
|
73
|
+
let nulls = start === 0 ? void 0 : nullMask(rowCount, start);
|
|
74
|
+
for (let index = start; index < rowCount; index += 1) {
|
|
75
|
+
const value = rows[index]?.[name] ?? null;
|
|
76
|
+
if (value === null) {
|
|
77
|
+
nulls ??= new Uint8Array(rowCount);
|
|
78
|
+
nulls[index] = 1;
|
|
79
|
+
} else if (typeof value === "number") {
|
|
80
|
+
values[index] = value;
|
|
81
|
+
} else {
|
|
82
|
+
return encodeMixed(name, rows);
|
|
83
|
+
}
|
|
106
84
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
return nulls === undefined ? { kind: "boolean", values } : { kind: "boolean", values, nulls };
|
|
85
|
+
return nulls === void 0 ? { kind: "number", values } : { kind: "number", values, nulls };
|
|
86
|
+
}
|
|
87
|
+
if (typeof first === "boolean") {
|
|
88
|
+
const values = new Uint8Array(rowCount);
|
|
89
|
+
let nulls = start === 0 ? void 0 : nullMask(rowCount, start);
|
|
90
|
+
for (let index = start; index < rowCount; index += 1) {
|
|
91
|
+
const value = rows[index]?.[name] ?? null;
|
|
92
|
+
if (value === null) {
|
|
93
|
+
nulls ??= new Uint8Array(rowCount);
|
|
94
|
+
nulls[index] = 1;
|
|
95
|
+
} else if (typeof value === "boolean") {
|
|
96
|
+
values[index] = value ? 1 : 0;
|
|
97
|
+
} else {
|
|
98
|
+
return encodeMixed(name, rows);
|
|
99
|
+
}
|
|
124
100
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
return nulls === undefined ? { kind: "datetime", values } : { kind: "datetime", values, nulls };
|
|
101
|
+
return nulls === void 0 ? { kind: "boolean", values } : { kind: "boolean", values, nulls };
|
|
102
|
+
}
|
|
103
|
+
if (first instanceof Date) {
|
|
104
|
+
const values = new Float64Array(rowCount);
|
|
105
|
+
let nulls = start === 0 ? void 0 : nullMask(rowCount, start);
|
|
106
|
+
for (let index = start; index < rowCount; index += 1) {
|
|
107
|
+
const value = rows[index]?.[name] ?? null;
|
|
108
|
+
if (value === null) {
|
|
109
|
+
nulls ??= new Uint8Array(rowCount);
|
|
110
|
+
nulls[index] = 1;
|
|
111
|
+
} else if (value instanceof Date) {
|
|
112
|
+
values[index] = dateMilliseconds(value);
|
|
113
|
+
} else {
|
|
114
|
+
return encodeMixed(name, rows);
|
|
115
|
+
}
|
|
142
116
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
const text = parts.join("");
|
|
164
|
-
return nulls === undefined
|
|
165
|
-
? { kind: "string", text, offsets }
|
|
166
|
-
: { kind: "string", text, offsets, nulls };
|
|
117
|
+
return nulls === void 0 ? { kind: "datetime", values } : { kind: "datetime", values, nulls };
|
|
118
|
+
}
|
|
119
|
+
if (typeof first === "string") {
|
|
120
|
+
const offsets = new Uint32Array(rowCount + 1);
|
|
121
|
+
let nulls = start === 0 ? void 0 : nullMask(rowCount, start);
|
|
122
|
+
const parts = [];
|
|
123
|
+
let length = 0;
|
|
124
|
+
for (let index = start; index < rowCount; index += 1) {
|
|
125
|
+
const value = rows[index]?.[name] ?? null;
|
|
126
|
+
if (value === null) {
|
|
127
|
+
nulls ??= new Uint8Array(rowCount);
|
|
128
|
+
nulls[index] = 1;
|
|
129
|
+
} else if (typeof value === "string") {
|
|
130
|
+
parts.push(value);
|
|
131
|
+
length += value.length;
|
|
132
|
+
} else {
|
|
133
|
+
return encodeMixed(name, rows);
|
|
134
|
+
}
|
|
135
|
+
offsets[index + 1] = length;
|
|
167
136
|
}
|
|
168
|
-
|
|
137
|
+
const text = parts.join("");
|
|
138
|
+
return nulls === void 0 ? { kind: "string", text, offsets } : { kind: "string", text, offsets, nulls };
|
|
139
|
+
}
|
|
140
|
+
return encodeMixed(name, rows);
|
|
169
141
|
}
|
|
170
142
|
function encodeMixed(name, rows) {
|
|
171
|
-
|
|
143
|
+
return { kind: "mixed", values: rows.map((row) => row[name] ?? null) };
|
|
172
144
|
}
|
|
173
|
-
/** A null mask whose first `nullCount` rows are already null. */
|
|
174
145
|
function nullMask(rowCount, nullCount) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
146
|
+
const nulls = new Uint8Array(rowCount);
|
|
147
|
+
nulls.fill(1, 0, nullCount);
|
|
148
|
+
return nulls;
|
|
178
149
|
}
|
|
179
|
-
/** Stores one decoded column into every row under `name`. */
|
|
180
150
|
function fillColumn(rows, name, column) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
193
|
-
index += 1;
|
|
194
|
-
}
|
|
195
|
-
return;
|
|
151
|
+
if (name === "__proto__") {
|
|
152
|
+
const values = decodeColumnValues(column, rows.length);
|
|
153
|
+
let index2 = 0;
|
|
154
|
+
for (const row of rows) {
|
|
155
|
+
Object.defineProperty(row, name, {
|
|
156
|
+
value: values[index2] ?? null,
|
|
157
|
+
enumerable: true,
|
|
158
|
+
configurable: true,
|
|
159
|
+
writable: true
|
|
160
|
+
});
|
|
161
|
+
index2 += 1;
|
|
196
162
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
else {
|
|
208
|
-
for (const row of rows) {
|
|
209
|
-
row[name] = nulls[index] === 1 ? null : (values[index] ?? 0);
|
|
210
|
-
index += 1;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
case "boolean": {
|
|
216
|
-
const { values, nulls } = column;
|
|
217
|
-
for (const row of rows) {
|
|
218
|
-
row[name] = nulls?.[index] === 1 ? null : values[index] === 1;
|
|
219
|
-
index += 1;
|
|
220
|
-
}
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
case "datetime": {
|
|
224
|
-
const { values, nulls } = column;
|
|
225
|
-
for (const row of rows) {
|
|
226
|
-
row[name] = nulls?.[index] === 1 ? null : new Date(values[index] ?? 0);
|
|
227
|
-
index += 1;
|
|
228
|
-
}
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
case "string": {
|
|
232
|
-
const { text, offsets, nulls } = column;
|
|
233
|
-
for (const row of rows) {
|
|
234
|
-
row[name] =
|
|
235
|
-
nulls?.[index] === 1 ? null : text.slice(offsets[index] ?? 0, offsets[index + 1] ?? 0);
|
|
236
|
-
index += 1;
|
|
237
|
-
}
|
|
238
|
-
return;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
let index = 0;
|
|
166
|
+
switch (column.kind) {
|
|
167
|
+
case "number": {
|
|
168
|
+
const { values, nulls } = column;
|
|
169
|
+
if (nulls === void 0) {
|
|
170
|
+
for (const row of rows) {
|
|
171
|
+
row[name] = values[index] ?? 0;
|
|
172
|
+
index += 1;
|
|
239
173
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
index += 1;
|
|
245
|
-
}
|
|
246
|
-
return;
|
|
174
|
+
} else {
|
|
175
|
+
for (const row of rows) {
|
|
176
|
+
row[name] = nulls[index] === 1 ? null : values[index] ?? 0;
|
|
177
|
+
index += 1;
|
|
247
178
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
179
|
+
}
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
case "boolean": {
|
|
183
|
+
const { values, nulls } = column;
|
|
184
|
+
for (const row of rows) {
|
|
185
|
+
row[name] = nulls?.[index] === 1 ? null : values[index] === 1;
|
|
186
|
+
index += 1;
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
251
189
|
}
|
|
190
|
+
case "datetime": {
|
|
191
|
+
const { values, nulls } = column;
|
|
192
|
+
for (const row of rows) {
|
|
193
|
+
row[name] = nulls?.[index] === 1 ? null : new Date(values[index] ?? 0);
|
|
194
|
+
index += 1;
|
|
195
|
+
}
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
case "string": {
|
|
199
|
+
const { text, offsets, nulls } = column;
|
|
200
|
+
for (const row of rows) {
|
|
201
|
+
row[name] = nulls?.[index] === 1 ? null : text.slice(offsets[index] ?? 0, offsets[index + 1] ?? 0);
|
|
202
|
+
index += 1;
|
|
203
|
+
}
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
case "mixed": {
|
|
207
|
+
const { values } = column;
|
|
208
|
+
for (const row of rows) {
|
|
209
|
+
row[name] = values[index] ?? null;
|
|
210
|
+
index += 1;
|
|
211
|
+
}
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
case "null":
|
|
215
|
+
for (const row of rows)
|
|
216
|
+
row[name] = null;
|
|
217
|
+
}
|
|
252
218
|
}
|
|
253
|
-
/** One column back into plain values, for the one name that cannot be assigned through. */
|
|
254
219
|
function decodeColumnValues(column, rowCount) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
case "null":
|
|
276
|
-
values.push(null);
|
|
277
|
-
}
|
|
220
|
+
const values = [];
|
|
221
|
+
for (let index = 0; index < rowCount; index += 1) {
|
|
222
|
+
switch (column.kind) {
|
|
223
|
+
case "number":
|
|
224
|
+
values.push(column.nulls?.[index] === 1 ? null : column.values[index] ?? 0);
|
|
225
|
+
break;
|
|
226
|
+
case "boolean":
|
|
227
|
+
values.push(column.nulls?.[index] === 1 ? null : column.values[index] === 1);
|
|
228
|
+
break;
|
|
229
|
+
case "datetime":
|
|
230
|
+
values.push(column.nulls?.[index] === 1 ? null : new Date(column.values[index] ?? 0));
|
|
231
|
+
break;
|
|
232
|
+
case "string":
|
|
233
|
+
values.push(column.nulls?.[index] === 1 ? null : column.text.slice(column.offsets[index] ?? 0, column.offsets[index + 1] ?? 0));
|
|
234
|
+
break;
|
|
235
|
+
case "mixed":
|
|
236
|
+
values.push(column.values[index] ?? null);
|
|
237
|
+
break;
|
|
238
|
+
case "null":
|
|
239
|
+
values.push(null);
|
|
278
240
|
}
|
|
279
|
-
|
|
241
|
+
}
|
|
242
|
+
return values;
|
|
280
243
|
}
|
|
244
|
+
export {
|
|
245
|
+
decodeQueryResult,
|
|
246
|
+
encodeQueryResult,
|
|
247
|
+
encodeQueryRows,
|
|
248
|
+
isWireQueryResult
|
|
249
|
+
};
|