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

Commit 05a1c6cb by Matt Broadstone

two more cases where ident and escape were stored function locally and then were…

… used in a find/findAll
1 parent 29a79549
Showing with 3 additions and 7 deletions
...@@ -869,8 +869,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -869,8 +869,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
it('sets deletedAt to the current timestamp if paranoid is true', function(done) { it('sets deletedAt to the current timestamp if paranoid is true', function(done) {
var self = this var self = this
, ident = self.sequelize.queryInterface.QueryGenerator.quoteIdentifier
, escape = self.sequelize.queryInterface.QueryGenerator.quote
, ParanoidUser = self.sequelize.define('ParanoidUser', { , ParanoidUser = self.sequelize.define('ParanoidUser', {
username: Sequelize.STRING, username: Sequelize.STRING,
secretValue: Sequelize.STRING, secretValue: Sequelize.STRING,
...@@ -892,7 +890,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -892,7 +890,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
expect(users.length).to.equal(1) expect(users.length).to.equal(1)
expect(users[0].username).to.equal("Bob") expect(users[0].username).to.equal("Bob")
self.sequelize.query('SELECT * FROM ' + ident('ParanoidUsers') + ' WHERE ' + ident('deletedAt') + ' IS NOT NULL ORDER BY ' + ident('id'), null, {raw: true}).success(function(users) { self.sequelize.query('SELECT * FROM ' + self.sequelize.queryInterface.QueryGenerator.quoteIdentifier('ParanoidUsers') + ' WHERE ' + self.sequelize.queryInterface.QueryGenerator.quoteIdentifier('deletedAt') + ' IS NOT NULL ORDER BY ' + self.sequelize.queryInterface.QueryGenerator.quoteIdentifier('id'), null, {raw: true}).success(function(users) {
expect(users[0].username).to.equal("Peter") expect(users[0].username).to.equal("Peter")
expect(users[1].username).to.equal("Paul") expect(users[1].username).to.equal("Paul")
...@@ -2011,14 +2009,12 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -2011,14 +2009,12 @@ 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.name) { if(this.User.name) {
tableName = ident(this.User.name) + '.' tableName = this.sequelize.queryInterface.QueryGenerator.quoteIdentifier(this.User.name) + '.'
} }
this.User.findAll({ this.User.findAll({
where: [ where: [
tableName + ident('deletedAt') + ' IS NOT NULL ' tableName + this.sequelize.queryInterface.QueryGenerator.quoteIdentifier('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!