Skip to content

Commit 3d52088

Browse files
authored
Merge pull request #490 from KxSystems/ee-struct
Client support for structuredText for kdb+ connections
2 parents 35df1fb + 22e22f8 commit 3d52088

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/classes/localConnection.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class LocalConnection {
187187
if (isPython) {
188188
args.push(!!stringify, command);
189189
} else {
190-
args.push(context ?? ".", command, !!stringify);
190+
args.push(context ?? ".", command, stringify ? "text" : "structuredText");
191191
}
192192

193193
args.push((err: Error, res: QueryResult) => {
@@ -219,6 +219,10 @@ export class LocalConnection {
219219
return { base64, result };
220220
}
221221

222+
if (!stringify) {
223+
return JSON.parse(result);
224+
}
225+
222226
if (ext.isResultsTabVisible && stringify) {
223227
if (this.isError) {
224228
this.isError = false;

src/services/resultsPanelProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
197197
);
198198

199199
columns.forEach((column) => {
200-
const { name, values, order } = column;
201-
order.forEach((pos, index) => {
202-
rowData[index][name] = decodeQUTF(values[pos]);
200+
const { name, values } = column;
201+
values.forEach((value, index) => {
202+
rowData[index][name] = decodeQUTF(value);
203203
});
204204
});
205205

@@ -235,7 +235,7 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
235235
let rowData = [];
236236
let columnDefs = [];
237237

238-
if (connVersion && compareVersions(connVersion, 1.12)) {
238+
if (!isInsights || (connVersion && compareVersions(connVersion, 1.12))) {
239239
rowData = this.updatedExtractRowData(results);
240240
columnDefs = this.updatedExtractColumnDefs(results);
241241
} else {

test/suite/panels.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ describe("WebPanels", () => {
249249
name: "prop1",
250250
type: "type1",
251251
values: ["value1", "value2"],
252-
order: [1, 2],
252+
order: [1, 0],
253253
},
254254
{
255255
name: "prop2",
256256
type: "type2",
257257
values: ["value3", "value4"],
258-
order: [1, 2],
258+
order: [1, 0],
259259
},
260260
],
261261
count: 2,
@@ -270,8 +270,8 @@ describe("WebPanels", () => {
270270
minWidth: 100,
271271
},
272272
rowData: [
273-
{ index: 1, prop1: "value2", prop2: "value4" },
274-
{ index: 2 },
273+
{ index: 1, prop1: "value1", prop2: "value3" },
274+
{ index: 2, prop1: "value2", prop2: "value4" },
275275
],
276276
columnDefs: [
277277
{ field: "index", headerName: "Index", cellDataType: "number" },

0 commit comments

Comments
 (0)