Permalink
Browse files

fix(lib/yukari.js): add another condition branch with no insertId whe…

…n insert
  • Loading branch information...
XadillaX committed Mar 9, 2016
1 parent 8e26822 commit f82f624921eac3a13bffbf5a2dcd562196299163
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/yukari.js
@@ -318,8 +318,8 @@ Yukari.prototype.insert = function(callback) {
} else {
// 有多个主键

for(var i = 0; i < self.$model.primaryKeys.length; i++) {
where[pk[0].name] = (self[pk[i].name] !== undefined) ?
for(var i = 0; i < pk.length; i++) {
where[pk[i].name] = (self[pk[i].name] !== undefined) ?
self[pk[i].name] : self[pk[i].column];
}

@@ -328,6 +328,11 @@ Yukari.prototype.insert = function(callback) {
self[ai.name] = row.insertId;
}
}
} else {
for(var i = 0; i < pk.length; i++) {
where[pk[i].name] = (self[pk[i].name] !== undefined) ?
self[pk[i].name] : self[pk[i].column];
}
}

self.$model.where(where).findOne(function(err, row) {

0 comments on commit f82f624

Please sign in to comment.