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

Commit adfeea85 by Matt Broadstone

final cleanups based on PR feedback

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