diff --git a/lib/dialects/sqlanywhere/index.js b/lib/dialects/sqlanywhere/index.js index d65bf66d37..a2326e61b3 100644 --- a/lib/dialects/sqlanywhere/index.js +++ b/lib/dialects/sqlanywhere/index.js @@ -118,26 +118,19 @@ class Client_Sqlanywhere extends Client { // Runs the query on the specified connection, providing the bindings // and any other necessary prep work. - _query(connection, obj) { + async _query(connection, obj) { if (!obj.sql) throw new Error('The query is empty'); - - return new Promise((resolve, reject) => { - let cb = (err, response) => { - if (err) return reject(err); - obj.response = response; - resolve(obj); - }; - if (obj.bindings) { - return connection.exec(obj.sql, obj.bindings, cb); - } - return connection.exec(obj.sql, cb); - }); + if (obj.bindings) { + obj.response = connection.exec(obj.sql, obj.bindings); + } + obj.response = connection.exec(obj.sql); + return obj; } // Process the response as returned from the query. processResponse(obj, runner) { let response = obj.response; - const method = obj.method; + const method = obj.method; if (obj.output) return obj.output.call(runner, response); switch (method) { case 'select': @@ -163,6 +156,10 @@ class Client_Sqlanywhere extends Client { } } + postProcessResponse(processedResponse, queryContext) { + return processedResponse; + } + ping(resource, callback) { resource.exec('SELECT 1', [], callback); } diff --git a/lib/execution/runner.js b/lib/execution/runner.js index ed01652923..953d429b00 100644 --- a/lib/execution/runner.js +++ b/lib/execution/runner.js @@ -148,7 +148,9 @@ class Runner { // dropColumn()/renameColumn(), it will be a Promise for the transaction // containing the complete rename procedure. return queryPromise - .then((resp) => this.client.processResponse(resp, runner)) + .then((resp) => { + return this.client.processResponse(resp, runner); + }) .then((processedResponse) => { const postProcessedResponse = this.client.postProcessResponse( processedResponse,