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

Commit ec40906e by Joel Trost Committed by Matt Broadstone

Bulkinsert switched to check for autoincrement

1 parent cdd839d0
Showing with 3 additions and 8 deletions
...@@ -152,7 +152,7 @@ module.exports = (function() { ...@@ -152,7 +152,7 @@ module.exports = (function() {
Parameters: table name + list of hashes of attribute-value-pairs. Parameters: table name + list of hashes of attribute-value-pairs.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
bulkInsertQuery: function(tableName, attrValueHashes,options, attributes) { bulkInsertQuery: function(tableName, attrValueHashes,options, attributes) {
var query = '', var query = '',
allAttributes = [], allAttributes = [],
insertKey = false, insertKey = false,
...@@ -165,7 +165,7 @@ module.exports = (function() { ...@@ -165,7 +165,7 @@ module.exports = (function() {
if(ignoreKeys.indexOf(aliasKey) < 0){ if(ignoreKeys.indexOf(aliasKey) < 0){
ignoreKeys.push(aliasKey); ignoreKeys.push(aliasKey);
} }
if(attributes[key].primaryKey){ if(attributes[key].autoIncrement){
for(var i = 0; i < attrValueHashes.length; i++){ for(var i = 0; i < attrValueHashes.length; i++){
if(aliasKey in attrValueHashes[i]){ if(aliasKey in attrValueHashes[i]){
delete attrValueHashes[i][aliasKey]; delete attrValueHashes[i][aliasKey];
...@@ -1396,12 +1396,7 @@ module.exports = (function() { ...@@ -1396,12 +1396,7 @@ module.exports = (function() {
} }
} }
} else { } else {
if (typeof value === 'boolean') { _value = SqlGenerator.escape(value);
_value = this.booleanValue(value);
} else {
_value = SqlGenerator.escape(value);
}
result.push((_value === 'NULL') ? _key + ' IS NULL' : [_key, _value].join('=')); result.push((_value === 'NULL') ? _key + ' IS NULL' : [_key, _value].join('='));
} }
}.bind(this)); }.bind(this));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!