diff --git a/CHANGELOG.md b/CHANGELOG.md index dac363c..db72d00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log + +## 0.0.7 + +Fix websocket max message size leading to broken fetches +Switch away from batch mode +Always show full schema +Fix issue with global connection state + ## 0.0.6 Fix pagination, fetch up to 1000 records from queries diff --git a/package.json b/package.json index 1e51d37..294509e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "exasol-driver", "displayName": "Exasol Driver", "description": "Exasol Driver for SQLTools", - "version": "0.0.6", + "version": "0.0.7", "engines": { "vscode": "^1.42.0" }, diff --git a/src/ls/driver.ts b/src/ls/driver.ts index a75e90b..6290fc3 100644 --- a/src/ls/driver.ts +++ b/src/ls/driver.ts @@ -9,6 +9,7 @@ import { zipObject, range, Dictionary } from 'lodash'; import Exasol from './wsjsapi'; import keywordsCompletion from './keywords'; import LRUCache from 'lru-cache'; +import { IClientConfig } from 'websocket'; // DriverLib type is any since the connection object obtained from Exasol is a plain JS object type DriverLib = any; @@ -43,7 +44,7 @@ type QueryFetchResult = { } const MAX_RESULTS = 1000 // rows -const FETCH_SIZE = 1000000 // 1MiB (bytes) +const FETCH_SIZE = 4 * 1024 * 1024 // 4MB (bytes) const QUERY_CACHE_SIZE = 100 // queries count const QUERY_CACHE_AGE = 1000 * 60 * 10 // 10 minutes (ms) @@ -73,7 +74,8 @@ export default class ExasolDriver extends AbstractDriver{ maxReceivedFrameSize: 2 * FETCH_SIZE }) ).then(db => new Promise((resolve, reject) => db.com({ @@ -111,20 +113,20 @@ export default class ExasolDriver extends AbstractDriver new Promise( - (resolve, reject) => db.com({ 'command': 'executeBatch', 'sqlTexts': splitQueries }, - resolve, - this.rejectErr(reject)) - ) - ); - const res = []; - for (let index = 0; index < responseData.results.length; index++) { - const result = responseData.results[index]; + const responses: QueryResponse[] = await Promise.all( + splitQueries.map((query) => this.queue.add(() => + new Promise((resolve, reject) => + db.com({ 'command': 'execute', 'sqlText': query }, resolve, this.rejectErr(reject)) + ) + ))); + + const res: NSDatabase.IResult[] = []; + for (let index = 0; index < responses.length; index++) { + const result = responses[index].results[0]; if (result.resultType === 'rowCount') { const message = `Query ok with ${result.rowCount} rows affected` this.log.info(message) - res.push({ + res.push({ cols: [], connId: this.getId(), messages: [{ date: new Date(), message: message }], diff --git a/src/ls/wsjsapi.js b/src/ls/wsjsapi.js index ec09a5f..712efd5 100644 --- a/src/ls/wsjsapi.js +++ b/src/ls/wsjsapi.js @@ -302,7 +302,7 @@ var json_parse = (function () { }; }()); -var Exasol = function(url, user, pass, onconnect, onerror) { +var Exasol = function(url, user, pass, onconnect, onerror, websocketConfig) { var context = this; context.onerror = onerror; context.sessionId = "-1"; @@ -489,7 +489,7 @@ var Exasol = function(url, user, pass, onconnect, onerror) { }; context.inwork = false; - context.connection = new WebSocket(url); + context.connection = new WebSocket(url, null, null, null, null, websocketConfig); context.connection.onerror = function(err) { onerror('Error connecting to "' + url + '"'); };