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

Commit fa784c59 by Matt Broadstone

fixed a few more failing cases

  - missed a case for addLimitAndOffset for subqueries with a single model
  - formatResults should return undefined if there is no data
  - there are a few possible error messages in an invalid connection scenario
1 parent 03845fa5
......@@ -1236,10 +1236,16 @@ module.exports = (function() {
if (options.order) {
if (Array.isArray(options.order)) {
options.order.forEach(function(t) {
if (!Array.isArray(t)) {
if (isSubQuery && !(t instanceof Model) && !(t.model instanceof Model)) {
subQueryOrder.push(this.quote(t, model));
}
} else {
if (isSubQuery && !(t[0] instanceof Model) && !(t[0].model instanceof Model)) {
subQueryOrder.push(this.quote(t, model));
}
mainQueryOrder.push(this.quote(t, model));
}
}.bind(this));
} else {
mainQueryOrder.push(options.order);
......
......@@ -113,11 +113,11 @@ module.exports = (function() {
*/
Query.prototype.formatResults = function(data) {
var result = this.callee;
if (data) {
if (this.isInsertQuery(data)) {
this.handleInsertQuery(data);
} else if (this.isShowTableQuery()) {
}
if (this.isShowTableQuery()) {
result = this.handleShowTableQuery(data);
} else if (this.isShowOrDescribeQuery()) {
result = data;
......@@ -145,9 +145,6 @@ module.exports = (function() {
} else if (this.isBulkDeleteQuery()){
result = data[0].AFFECTEDROWS;
}
} else if (!result) {
result = data;
}
return result;
};
......
......@@ -113,23 +113,26 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
.authenticate()
.complete(function(err, result) {
if (dialect === 'mariadb') {
expect(err.message).to.match(/Access denied for user/)
expect(err.message).to.match(/Access denied for user/);
} else if (dialect === 'postgres') {
expect(
err.message.match(/connect ECONNREFUSED/) ||
err.message.match(/invalid port number/)
).to.be.ok
).to.be.ok;
} else if (dialect === 'mssql'){
expect(err.message.match(/ConnectionError: Login failed for user/)).to.be.ok
expect(
err.message.match(/ConnectionError: Login failed for user/) ||
err.message.match(/RangeError: Port should be > 0 and < 65536/)
).to.be.ok;
} else {
expect(err.message).to.match(/connect ECONNREFUSED/)
}
done()
done();
})
})
})
});
});
});
describe('with invalid credentials', function() {
beforeEach(function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!