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

Commit 195e8554 by Joel Trost Committed by Matt Broadstone

Fixed default select type

1 parent 8d9eb560
......@@ -114,6 +114,8 @@ 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()) {
......@@ -141,12 +143,11 @@ module.exports = (function() {
} else if (this.isBulkUpdateQuery() || this.isBulkDeleteQuery()) {
result = data.affectedRows;
}else {
if(this.options.type && !this.options.raw){
result = this.handleSelectQuery(data);
}
}else{
result = data;
}
}
return result;
};
......
......@@ -991,9 +991,9 @@ describe(Support.getTestDialectTeaser("Model"), function () {
it('properly handles disparate field lists', function(done) {
var self = this
, data = [{username: 'Peter', secretValue: '42' },
{username: 'Paul'},
{username: 'Steve'}]
, data = [{username: 'Peter', secretValue: '42', uniqueName:'1' },
{username: 'Paul', uniqueName:'2'},
{username: 'Steve', uniqueName:'3'}]
this.User.bulkCreate(data).success(function() {
self.User.findAll({where: {username: 'Paul'}}).success(function(users) {
......@@ -1007,10 +1007,10 @@ describe(Support.getTestDialectTeaser("Model"), function () {
it('inserts multiple values respecting the white list', function(done) {
var self = this
, data = [{ username: 'Peter', secretValue: '42' },
{ username: 'Paul', secretValue: '23'}]
, data = [{ username: 'Peter', secretValue: '42', uniqueName:'1' },
{ username: 'Paul', secretValue: '23', uniqueName:'2'}]
this.User.bulkCreate(data, { fields: ['username'] }).success(function() {
this.User.bulkCreate(data, { fields: ['username','uniqueName'] }).success(function() {
self.User.findAll({order: 'id'}).success(function(users) {
expect(users.length).to.equal(2)
expect(users[0].username).to.equal("Peter")
......@@ -1024,8 +1024,8 @@ describe(Support.getTestDialectTeaser("Model"), function () {
it('should store all values if no whitelist is specified', function(done) {
var self = this
, data = [{ username: 'Peter', secretValue: '42' },
{ username: 'Paul', secretValue: '23'}]
, data = [{ username: 'Peter', secretValue: '42', uniqueName:'1' },
{ username: 'Paul', secretValue: '23', uniqueName:'2'}]
this.User.bulkCreate(data).success(function() {
self.User.findAll({order: 'id'}).success(function(users) {
......
......@@ -99,7 +99,6 @@ describe(Support.getTestDialectTeaser("QueryInterface"), function () {
self.queryInterface.showIndex('Group').complete(function(err, indexes) {
expect(err).to.be.null
console.log(indexes);
indexColumns = _.uniq(indexes.map(function(index) { return index.name }))
expect(indexColumns).to.be.empty
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!