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

Commit 195e8554 by Joel Trost Committed by Matt Broadstone

Fixed default select type

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