Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
"onLanguage:sql",
"onCommand:sqltools.*"
],
"contributes": {
"configuration": {
"title": "SQLTools InterSystems IRIS Driver",
"properties": {
"sqltools-intersystems-driver.resultSetRowLimit": {
"description": "Maximum number of rows returned by any query, including metadata queries. Use 0 for no limit, which may cause timeouts or other failures. Setting is applied at connection time and is ignored by server versions earlier than 2023.1.",
"type": "integer",
"default": 1000,
"minimum": 0
}
}
}
},
"main": "./dist/extension.js",
"ls": "./dist/ls/plugin.js",
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export async function activate(extContext: ExtensionContext): Promise<IDriverExt
await resolvePassword(connSpec);
resolvedConnSpecs.set(serverName, connSpec);
}
const resultSetRowLimit = vscode.workspace.getConfiguration('sqltools-intersystems-driver').get('resultSetRowLimit');
connInfo = { ...connInfo,
https: connSpec.webServer.scheme === 'https',
server: connSpec.webServer.host,
Expand All @@ -157,6 +158,7 @@ export async function activate(extContext: ExtensionContext): Promise<IDriverExt
username: connSpec.username,
password: connSpec.password,
namespace,
resultSetRowLimit,
}
}
return connInfo;
Expand Down
8 changes: 5 additions & 3 deletions src/ls/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class IRISDriver extends AbstractDriver<IRISdb, DriverOptions> im
queries: IQueries = queries;
private showSystem = false;
private filter = "";
private resultSetRowLimit;

public async open() {
if (this.connection) {
Expand All @@ -26,7 +27,7 @@ export default class IRISDriver extends AbstractDriver<IRISdb, DriverOptions> im
this.showSystem = this.credentials.showSystem || false;
this.filter = this.credentials.filter || "";

let { https, server: host, port, pathPrefix, username, password } = this.credentials;
let { https, server: host, port, pathPrefix, username, password, resultSetRowLimit } = this.credentials;
config = {
https,
host,
Expand All @@ -36,8 +37,9 @@ export default class IRISDriver extends AbstractDriver<IRISdb, DriverOptions> im
username,
password
};
this.resultSetRowLimit = resultSetRowLimit;

const irisdb = new IRISdb(config);
const irisdb = new IRISdb(config, resultSetRowLimit);
return irisdb.open()
.then(() => {
this.connection = Promise.resolve(irisdb);
Expand Down Expand Up @@ -91,7 +93,7 @@ export default class IRISDriver extends AbstractDriver<IRISdb, DriverOptions> im
resultsAgg.push({
cols,
connId: this.getId(),
messages: [{ date: new Date(), message: `Query ok with ${queryResult[0]?.content.length ?? 'no'} results` }],
messages: [{ date: new Date(), message: `Query ok with ${queryResult[0]?.content.length ?? 'no'} results (resultSetRowLimit = ${this.resultSetRowLimit})` }],
results: this.mapRows(queryResult[0]?.content, cols),
query: queries.toString(),
requestId: opt.requestId,
Expand Down
6 changes: 4 additions & 2 deletions src/ls/irisdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ export interface IQueries extends IBaseQueries {
export default class IRISdb {

private config: IRISDirect;
private resultSetRowLimit: number;
private cookies: string[] = [];
private _apiVersion = 1;

public get apiVersion() {
return this._apiVersion;
}

public constructor(config: IRISDirect) {
public constructor(config: IRISDirect, resultSetRowLimit: number) {
this.config = config;
this.config.namespace = this.config.namespace.toUpperCase();
this.resultSetRowLimit = resultSetRowLimit;
}

public updateCookies(newCookies: string[]): void {
Expand Down Expand Up @@ -187,7 +189,7 @@ export default class IRISdb {
return this.request(1, "POST", `${this.config.namespace}/action/query`, {
parameters,
query,
}, this._apiVersion >= 6 ? { positional: true } : {}).then(data => data.result)
}, this._apiVersion >= 6 ? { positional: true , max: this.resultSetRowLimit > 0 ? this.resultSetRowLimit : undefined } : {}).then(data => data.result)
}


Expand Down
Loading