@@ -9,6 +9,7 @@ import { zipObject, range, Dictionary } from 'lodash';
99import Exasol from './wsjsapi' ;
1010import keywordsCompletion from './keywords' ;
1111import LRUCache from 'lru-cache' ;
12+ import { IClientConfig } from 'websocket' ;
1213
1314// DriverLib type is any since the connection object obtained from Exasol is a plain JS object
1415type DriverLib = any ;
@@ -43,7 +44,7 @@ type QueryFetchResult = {
4344}
4445
4546const MAX_RESULTS = 1000 // rows
46- const FETCH_SIZE = 1000000 // 1MiB (bytes)
47+ const FETCH_SIZE = 4 * 1024 * 1024 // 4MB (bytes)
4748const QUERY_CACHE_SIZE = 100 // queries count
4849const QUERY_CACHE_AGE = 1000 * 60 * 10 // 10 minutes (ms)
4950
@@ -73,7 +74,8 @@ export default class ExasolDriver extends AbstractDriver<DriverLib, DriverOption
7374 Exasol . call ( { } , // we must pass a new thisArg object each time as connection state is kept there and we might spawn multiple connections
7475 `ws://${ this . credentials . server } :${ this . credentials . port } ` , this . credentials . username , this . credentials . password ,
7576 resolve ,
76- this . rejectErr ( reject ) )
77+ this . rejectErr ( reject ) ,
78+ < IClientConfig > { maxReceivedFrameSize : 2 * FETCH_SIZE } )
7779 ) . then ( db =>
7880 new Promise ( ( resolve , reject ) =>
7981 db . com ( {
@@ -111,20 +113,20 @@ export default class ExasolDriver extends AbstractDriver<DriverLib, DriverOption
111113 const db = await this . open ( ) ;
112114 const splitQueries = parse ( queries ) ;
113115
114- const responseData : QueryResponse = await this . queue . add (
115- ( ) => new Promise (
116- ( resolve , reject ) => db . com ( { 'command' : 'executeBatch' , 'sqlTexts' : splitQueries } ,
117- resolve ,
118- this . rejectErr ( reject ) )
119- )
120- ) ;
121- const res = [ ] ;
122- for ( let index = 0 ; index < responseData . results . length ; index ++ ) {
123- const result = responseData . results [ index ] ;
116+ const responses : QueryResponse [ ] = await Promise . all < QueryResponse > (
117+ splitQueries . map ( ( query ) => this . queue . add ( ( ) =>
118+ new Promise ( ( resolve , reject ) =>
119+ db . com ( { 'command' : 'execute' , 'sqlText' : query } , resolve , this . rejectErr ( reject ) )
120+ )
121+ ) ) ) ;
122+
123+ const res : NSDatabase . IResult [ ] = [ ] ;
124+ for ( let index = 0 ; index < responses . length ; index ++ ) {
125+ const result = responses [ index ] . results [ 0 ] ;
124126 if ( result . resultType === 'rowCount' ) {
125127 const message = `Query ok with ${ result . rowCount } rows affected`
126128 this . log . info ( message )
127- res . push ( < NSDatabase . IResult > {
129+ res . push ( {
128130 cols : [ ] ,
129131 connId : this . getId ( ) ,
130132 messages : [ { date : new Date ( ) , message : message } ] ,
0 commit comments