Skip to content

Commit

Permalink
Merge pull request #490 from KxSystems/ee-struct
Browse files Browse the repository at this point in the history
Client support for structuredText for kdb+ connections
  • Loading branch information
ecmel authored Jan 6, 2025
2 parents 35df1fb + 22e22f8 commit 3d52088
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/classes/localConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class LocalConnection {
if (isPython) {
args.push(!!stringify, command);
} else {
args.push(context ?? ".", command, !!stringify);
args.push(context ?? ".", command, stringify ? "text" : "structuredText");
}

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

if (!stringify) {
return JSON.parse(result);
}

if (ext.isResultsTabVisible && stringify) {
if (this.isError) {
this.isError = false;
Expand Down
8 changes: 4 additions & 4 deletions src/services/resultsPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
);

columns.forEach((column) => {
const { name, values, order } = column;
order.forEach((pos, index) => {
rowData[index][name] = decodeQUTF(values[pos]);
const { name, values } = column;
values.forEach((value, index) => {
rowData[index][name] = decodeQUTF(value);
});
});

Expand Down Expand Up @@ -235,7 +235,7 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
let rowData = [];
let columnDefs = [];

if (connVersion && compareVersions(connVersion, 1.12)) {
if (!isInsights || (connVersion && compareVersions(connVersion, 1.12))) {
rowData = this.updatedExtractRowData(results);
columnDefs = this.updatedExtractColumnDefs(results);
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/suite/panels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ describe("WebPanels", () => {
name: "prop1",
type: "type1",
values: ["value1", "value2"],
order: [1, 2],
order: [1, 0],
},
{
name: "prop2",
type: "type2",
values: ["value3", "value4"],
order: [1, 2],
order: [1, 0],
},
],
count: 2,
Expand All @@ -270,8 +270,8 @@ describe("WebPanels", () => {
minWidth: 100,
},
rowData: [
{ index: 1, prop1: "value2", prop2: "value4" },
{ index: 2 },
{ index: 1, prop1: "value1", prop2: "value3" },
{ index: 2, prop1: "value2", prop2: "value4" },
],
columnDefs: [
{ field: "index", headerName: "Index", cellDataType: "number" },
Expand Down

0 comments on commit 3d52088

Please sign in to comment.