不要怂,就是干,撸起袖子干!

Commit f7304d7f by maximeCony

build where with quoteIdentifier and escape

1 parent b1d48a48
Showing with 7 additions and 4 deletions
...@@ -1710,12 +1710,14 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1710,12 +1710,14 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it('should not fail with an include', function(done) { it('should not fail with an include', function(done) {
var tableName = '' var tableName = ''
, ident = this.sequelize.queryInterface.QueryGenerator.quoteIdentifier
, escape = this.sequelize.queryInterface.QueryGenerator.escape
if(this.Project.tableName) { if(this.Project.tableName) {
tableName = '"' + this.Project.tableName + '".' tableName = ident(this.Project.tableName) + '.'
} }
this.User.findAll({ this.User.findAll({
where: [ where: [
tableName + '"title" = \'republic\' ' tableName + ident('title') + ' = ' + escape('republic')
], ],
include: [ include: [
{model: this.Project} {model: this.Project}
...@@ -1734,12 +1736,13 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1734,12 +1736,13 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it('should not overwrite a specified deletedAt', function(done) { it('should not overwrite a specified deletedAt', function(done) {
var tableName = '' var tableName = ''
, ident = this.sequelize.queryInterface.QueryGenerator.quoteIdentifier
if(this.User.tableName) { if(this.User.tableName) {
tableName = '"' + this.User.tableName + '".' tableName = ident(this.User.tableName) + '.'
} }
this.User.findAll({ this.User.findAll({
where: [ where: [
tableName + '"deletedAt" IS NOT NULL ' tableName + ident('deletedAt') + ' IS NOT NULL '
], ],
include: [ include: [
{model: this.Project} {model: this.Project}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!