Skip to content

Commit

Permalink
feat(get-raw-sql): add check on select for getRawSql
Browse files Browse the repository at this point in the history
exit and return query without execute it
  • Loading branch information
seromenho committed Aug 3, 2020
1 parent e144683 commit 47006a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dialects/abstract/query-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,13 @@ class QueryInterface {

async select(model, tableName, optionsArg) {
const options = { ...optionsArg, type: QueryTypes.SELECT, model };
const query = this.QueryGenerator.selectQuery(tableName, options, model);

return await this.sequelize.query(this.queryGenerator.selectQuery(tableName, options, model), options);
if (options.getRawSql) {
return Promise.resolve({ query });
}

return await this.sequelize.query(query, options);
}

async increment(model, tableName, where, incrementAmountsByField, extraAttributesToBeUpdated, options) {
Expand Down

0 comments on commit 47006a8

Please sign in to comment.