diff --git a/lib/mysql.js b/lib/mysql.js index 05b7edd..895d4ff 100644 --- a/lib/mysql.js +++ b/lib/mysql.js @@ -317,6 +317,14 @@ MySQL.prototype.escapeName = function (name) { return '`' + name.replace(/\./g, '`.`') + '`'; }; +MySQL.prototype.escapeId = function (id) { + if (isNaN(id) || this.schema.settings.slave) { + return '"' + ('undefined' === typeof id ? '' : id.toString().replace(/["\n]/g, '')) + '"'; + } + + return Number(id); +}; + MySQL.prototype.all = function all(model, filter, callback) { var sql = 'SELECT * FROM ' + this.tableEscaped(model); @@ -1013,7 +1021,7 @@ function buildWhrSet() { } MySQL.prototype.update = function all(model, filter, callback) { - + var queryresulterr=[]; var queryresultinfo=[]; var querynum=0; @@ -1025,7 +1033,7 @@ MySQL.prototype.update = function all(model, filter, callback) { if (!Array.isArray(filter)) filter = [filter]; - + for (var i = 0; i