sequelize
Advanced tools
Comparing version 1.6.0-beta-3 to 1.6.0-beta4
@@ -185,3 +185,3 @@ var Utils = require("../../utils") | ||
return hashToWhereConditions(hash) | ||
return hashToWhereConditions(hash).replace(/\\'/g, "''"); | ||
} | ||
@@ -188,0 +188,0 @@ } |
@@ -142,3 +142,3 @@ var Utils = require("./utils") | ||
options = Utils._.extend(Utils._.clone(this.options.query), options) | ||
options = Utils._.extend(options, { | ||
options = Utils._.defaults(options, { | ||
logging: this.options.hasOwnProperty('logging') ? this.options.logging : console.log, | ||
@@ -145,0 +145,0 @@ type: (sql.toLowerCase().indexOf('select') === 0) ? 'SELECT' : false |
{ | ||
"name": "sequelize", | ||
"description": "Multi dialect ORM for Node.JS", | ||
"version": "1.6.0-beta-3", | ||
"version": "1.6.0-beta4", | ||
"author": "Sascha Depold <sascha@depold.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -101,2 +101,36 @@ if(typeof require === 'function') { | ||
}) | ||
describe('findAll', function findAll() { | ||
it("escapes a single single quotes properly in where clauses", function(done) { | ||
var self = this | ||
this.User | ||
.create({ username: "user'name" }) | ||
.success(function() { | ||
self.User.findAll({ | ||
where: { username: "user'name" } | ||
}).success(function(users) { | ||
expect(users.length).toEqual(1) | ||
expect(users[0].username).toEqual("user'name") | ||
done() | ||
}) | ||
}) | ||
}) | ||
it("escapes two single quotes properly in where clauses", function(done) { | ||
var self = this | ||
this.User | ||
.create({ username: "user''name" }) | ||
.success(function() { | ||
self.User.findAll({ | ||
where: { username: "user''name" } | ||
}).success(function(users) { | ||
expect(users.length).toEqual(1) | ||
expect(users[0].username).toEqual("user''name") | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
2541358
9530