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

Commit 15e961e5 by Mick Hansen

fix more tests, again

1 parent 4df0e8e9
......@@ -1287,8 +1287,8 @@ module.exports = (function() {
return options
}
if(this.tableName) {
quoteIdentifiedDeletedAtCol = this.QueryInterface.quoteIdentifier(this.tableName) + '.' + quoteIdentifiedDeletedAtCol
if(this.name || this.tableName) {
quoteIdentifiedDeletedAtCol = this.QueryInterface.quoteIdentifier(this.name || this.tableName) + '.' + quoteIdentifiedDeletedAtCol
}
if (typeof options.where === "string") {
......
......@@ -986,6 +986,9 @@ module.exports = (function() {
if (Array.isArray(tableName)) {
tableName = tableName[0]
if (Array.isArray(tableName)) {
tableName = tableName[1]
}
}
options = options || {}
......
......@@ -1937,17 +1937,16 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
var tableName = ''
, ident = this.sequelize.queryInterface.QueryGenerator.quoteIdentifier
, escape = this.sequelize.queryInterface.QueryGenerator.escape
if(this.Project.name) {
tableName = ident(this.Project.name) + '.'
}
this.User.findAll({
where: [
tableName + ident('title') + ' = ' + escape('republic')
this.sequelize.queryInterface.QueryGenerator.quoteIdentifiers('Projects.title') + ' = ' + escape('republic')
],
include: [
{model: this.Project}
]
}).success(function(users){
}).done(function(err, users){
expect(err).not.to.be.ok
try{
expect(users.length).to.be.equal(1)
......@@ -1956,7 +1955,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}catch(e){
done(e)
}
}).error(done)
})
})
it('should not overwrite a specified deletedAt', function(done) {
......
......@@ -767,10 +767,10 @@ if (dialect.match(/^postgres/)) {
arguments: ['myTable', {name: "foo';DROP TABLE myTable;"}, {limit: 10}],
expectation: "DELETE FROM \"myTable\" WHERE \"id\" IN (SELECT \"id\" FROM \"myTable\" WHERE \"name\"='foo'';DROP TABLE myTable;' LIMIT 10)"
}, {
arguments: [{schema: 'mySchema', tableName: 'myTable'}, {name: 'foo'}],
arguments: ['mySchema.myTable', {name: 'foo'}],
expectation: "DELETE FROM \"mySchema\".\"myTable\" WHERE \"id\" IN (SELECT \"id\" FROM \"mySchema\".\"myTable\" WHERE \"name\"='foo' LIMIT 1)"
}, {
arguments: [{schema: 'mySchema', tableName: 'myTable'}, {name: "foo';DROP TABLE mySchema.myTable;"}, {limit: 10}],
arguments: ['mySchema.myTable', {name: "foo';DROP TABLE mySchema.myTable;"}, {limit: 10}],
expectation: "DELETE FROM \"mySchema\".\"myTable\" WHERE \"id\" IN (SELECT \"id\" FROM \"mySchema\".\"myTable\" WHERE \"name\"='foo'';DROP TABLE mySchema.myTable;' LIMIT 10)"
}, {
arguments: ['myTable', {name: 'foo'}, {limit: null}],
......@@ -795,11 +795,11 @@ if (dialect.match(/^postgres/)) {
expectation: "DELETE FROM myTable WHERE id IN (SELECT id FROM myTable WHERE name='foo'';DROP TABLE myTable;' LIMIT 10)",
context: {options: {quoteIdentifiers: false}}
}, {
arguments: [{schema: 'mySchema', tableName: 'myTable'}, {name: 'foo'}],
arguments: ['mySchema.myTable', {name: 'foo'}],
expectation: "DELETE FROM mySchema.myTable WHERE id IN (SELECT id FROM mySchema.myTable WHERE name='foo' LIMIT 1)",
context: {options: {quoteIdentifiers: false}}
}, {
arguments: [{schema: 'mySchema', tableName: 'myTable'}, {name: "foo';DROP TABLE mySchema.myTable;"}, {limit: 10}],
arguments: ['mySchema.myTable', {name: "foo';DROP TABLE mySchema.myTable;"}, {limit: 10}],
expectation: "DELETE FROM mySchema.myTable WHERE id IN (SELECT id FROM mySchema.myTable WHERE name='foo'';DROP TABLE mySchema.myTable;' LIMIT 10)",
context: {options: {quoteIdentifiers: false}}
}, {
......
......@@ -227,7 +227,7 @@ describe(Support.getTestDialectTeaser("Promise"), function () {
.then(function() {
return Book
.find({
where: (dialect === 'postgres' ? '"Books"."id"=' : '`Books`.`id`=') + book.id,
where: (dialect === 'postgres' ? '"Book"."id"=' : '`Book`.`id`=') + book.id,
include: [Page]
})
.then(function (leBook) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!