Fix replaceById for Oracle
This commit is contained in:
parent
22a39025a1
commit
5dc110afbf
|
@ -689,10 +689,14 @@ SQLConnector.prototype.update = function(model, where, data, options, cb) {
|
||||||
* @param {Function} cb The callback function
|
* @param {Function} cb The callback function
|
||||||
*/
|
*/
|
||||||
SQLConnector.prototype._replace = function(model, where, data, options, cb) {
|
SQLConnector.prototype._replace = function(model, where, data, options, cb) {
|
||||||
|
var self = this;
|
||||||
var stmt = this.buildReplace(model, where, data, options);
|
var stmt = this.buildReplace(model, where, data, options);
|
||||||
this.execute(stmt.sql, stmt.params, options, function(err, info) {
|
this.execute(stmt.sql, stmt.params, options, function(err, info) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
if (info.affectedRows === 0) {
|
var affectedRows = self.getCountForAffectedRows(model, info);
|
||||||
|
var rowCount = typeof (affectedRows) === 'number' ?
|
||||||
|
affectedRows : info.affectedRows;
|
||||||
|
if (rowCount === 0) {
|
||||||
return cb(errorIdNotFoundForReplace(where.id));
|
return cb(errorIdNotFoundForReplace(where.id));
|
||||||
} else {
|
} else {
|
||||||
return cb(null, info);
|
return cb(null, info);
|
||||||
|
|
Loading…
Reference in New Issue