Skip to content

Commit

Permalink
fix: mariadb
Browse files Browse the repository at this point in the history
  • Loading branch information
sushantdhiman committed May 23, 2020
1 parent 49d7e0f commit f0de18f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/dialects/mariadb/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ class Query extends AbstractQuery {
formatResults(data) {
let result = this.instance;

if (this.isBulkUpdateQuery() || this.isBulkDeleteQuery()
|| this.isUpsertQuery()) {
if (this.isBulkUpdateQuery() || this.isBulkDeleteQuery()) {
return data.affectedRows;
}
if (this.isInsertQuery(data)) {
if (this.isUpsertQuery()) {
return [null, data.affectedRows === 1];
}
if (this.isInsertQuery(data) || this.isUpsertQuery()) {
this.handleInsertQuery(data);

if (!this.instance) {
Expand All @@ -114,9 +116,12 @@ class Query extends AbstractQuery {
for (let i = 0; i < data.affectedRows; i++) {
result[i] = { [pkField]: startId + i };
}
return [result, data.affectedRows];
response = result;
} else {
response = data[this.getInsertIdField()];
}
return [data[this.getInsertIdField()], data.affectedRows];

return [response, data.affectedRows];
}
}

Expand Down

0 comments on commit f0de18f

Please sign in to comment.