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

You need to sign in or sign up before continuing.
Commit 0107d544 by Matt Broadstone

fix virtual attributes in insert and update statements

VIRTUAL attributes were accidentally being included in INSERT and UPDATE
statements as OUTPUT variables
1 parent 31e9b3f1
Showing with 8 additions and 6 deletions
......@@ -360,13 +360,15 @@ module.exports = {
var selFields = [];
var insertKey = false;
for (var key in modelAttributeMap) {
selFields.push('INSERTED.' + quoteIdentifier( (modelAttributeMap[key].field || key)));
if(modelAttributeMap[key].autoIncrement
&& (valueHash[key] === 'DEFAULT'
|| valueHash[key] === null)){
if (Utils._.isFunction(modelAttributeMap[key].type) &&
modelAttributeMap[key].type() === undefined) // VIRTUAL field
continue;
selFields.push('INSERTED.' + quoteIdentifier((modelAttributeMap[key].field || key)));
if (modelAttributeMap[key].autoIncrement &&
(valueHash[key] === 'DEFAULT' || valueHash[key] === null)) {
delete valueHash[key];
}else if(valueHash[key]
&& modelAttributeMap[key].autoIncrement){
} else if(valueHash[key] && modelAttributeMap[key].autoIncrement) {
insertKey = true;
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!