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

Commit adfeea85 by Matt Broadstone

final cleanups based on PR feedback

1 parent b2bcb304
...@@ -40,6 +40,8 @@ matrix: ...@@ -40,6 +40,8 @@ matrix:
allow_failures: allow_failures:
- node_js: "0.10" - node_js: "0.10"
env: COVERAGE=true env: COVERAGE=true
- node_js: "0.10"
env: DB=mysql DIALECT=mssql
notifications: notifications:
hipchat: hipchat:
......
...@@ -196,7 +196,7 @@ module.exports = (function() { ...@@ -196,7 +196,7 @@ module.exports = (function() {
}, },
bulkInsertQuery: function(tableName, attrValueHashes, options, attributes) { bulkInsertQuery: function(tableName, attrValueHashes, options, attributes) {
var query = 'INSERT<%= ignoreDuplicates %> INTO <%= table %> (<%= attributes %>) VALUES <%= tuples %>;' var query = 'INSERT INTO <%= table %> (<%= attributes %>) VALUES <%= tuples %>;'
, emptyQuery = 'INSERT INTO <%= table %> DEFAULT VALUES' , emptyQuery = 'INSERT INTO <%= table %> DEFAULT VALUES'
, tuples = [] , tuples = []
, allAttributes = [] , allAttributes = []
...@@ -239,7 +239,6 @@ module.exports = (function() { ...@@ -239,7 +239,6 @@ module.exports = (function() {
} }
var replacements = { var replacements = {
ignoreDuplicates: options && options.ignoreDuplicates ? ' IGNORE' : '',
table: this.quoteTable(tableName), table: this.quoteTable(tableName),
attributes: allAttributes.map(function(attr) { attributes: allAttributes.map(function(attr) {
return this.quoteIdentifier(attr); return this.quoteIdentifier(attr);
......
...@@ -77,23 +77,10 @@ module.exports = (function() { ...@@ -77,23 +77,10 @@ module.exports = (function() {
}); });
request.on('row', function(columns) { request.on('row', function(columns) {
var col, exi, row, _i, _len; var row = {};
row = {}; columns.forEach(function(column) {
for (_i = 0, _len = columns.length; _i < _len; _i++) { row[column.metadata.colName] = column.value;
col = columns[_i]; });
/* col.value = valueCorrection(col.value, col.metadata); */
// exi = row[col.metadata.colName];
exi = null;
if (exi !== null) {
if (exi instanceof Array) {
exi.push(col.value);
} else {
row[col.metadata.colName] = [exi, col.value];
}
} else {
row[col.metadata.colName] = col.value;
}
}
results.push(row); results.push(row);
}); });
......
...@@ -1259,10 +1259,10 @@ module.exports = (function() { ...@@ -1259,10 +1259,10 @@ module.exports = (function() {
} }
var dialect = this.sequelize.options.dialect; var dialect = this.sequelize.options.dialect;
if (options.ignoreDuplicates && dialect === 'postgres') { if (options.ignoreDuplicates && ['postgres', 'mssql'].indexOf(dialect) !== -1) {
return Promise.reject(new Error('Postgres does not support the \'ignoreDuplicates\' option.')); return Promise.reject(new Error(dialect + ' does not support the \'ignoreDuplicates\' option.'));
} }
if (options.updateOnDuplicate && ['mysql', 'mariadb', 'mssql'].indexOf(dialect) === -1) { if (options.updateOnDuplicate && ['mysql', 'mariadb'].indexOf(dialect) === -1) {
return Promise.reject(new Error(dialect + ' does not support the \'updateOnDuplicate\' option.')); return Promise.reject(new Error(dialect + ' does not support the \'updateOnDuplicate\' option.'));
} }
......
...@@ -1278,9 +1278,10 @@ describe(Support.getTestDialectTeaser("Model"), function () { ...@@ -1278,9 +1278,10 @@ describe(Support.getTestDialectTeaser("Model"), function () {
self.User.bulkCreate(data, { fields: ['uniqueName', 'secretValue'], ignoreDuplicates: true }).error(function(err) { self.User.bulkCreate(data, { fields: ['uniqueName', 'secretValue'], ignoreDuplicates: true }).error(function(err) {
expect(err).to.exist expect(err).to.exist
if (dialect === 'mssql') { if (dialect === 'mssql') {
expect(err.message).to.match(/MSSQL does not support the \'ignoreDuplicates\' option./) console.log(err.message);
expect(err.message).to.match(/mssql does not support the \'ignoreDuplicates\' option./)
} else { } else {
expect(err.message).to.match(/Postgres does not support the \'ignoreDuplicates\' option./) expect(err.message).to.match(/postgres does not support the \'ignoreDuplicates\' option./)
} }
done(); done();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!