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

Commit 1083d7eb by Daniel Durante

Merge pull request #751 from janmeier/master

Fix for problems with quoteidentifiers 
2 parents e80cf3a1 16faae84
...@@ -111,7 +111,7 @@ module.exports = (function() { ...@@ -111,7 +111,7 @@ module.exports = (function() {
} else { } else {
// Postgres will treat tables as case-insensitive, so fix the case // Postgres will treat tables as case-insensitive, so fix the case
// of the returned values to match attributes // of the returned values to match attributes
if(this.sequelize.options.quoteIdentifiers == false) { if(this.options.raw === false && this.sequelize.options.quoteIdentifiers === false) {
var attrsMap = Utils._.reduce(this.callee.attributes, function(m, v, k) { m[k.toLowerCase()] = k; return m}, {}) var attrsMap = Utils._.reduce(this.callee.attributes, function(m, v, k) { m[k.toLowerCase()] = k; return m}, {})
rows.forEach(function(row) { rows.forEach(function(row) {
Utils._.keys(row).forEach(function(key) { Utils._.keys(row).forEach(function(key) {
......
...@@ -91,6 +91,22 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() { ...@@ -91,6 +91,22 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() {
}.bind(this)) }.bind(this))
}) })
it('executes select queries correctly when quoteIdentifiers is false', function(done) {
this.sequelize.options.quoteIdentifiers = false
this.sequelize.query(this.insertQuery).success(function() {
this.sequelize
.query("select * from " + qq(this.User.tableName) + "")
.complete(function(err, users) {
if (err) {
console.log(err)
}
expect(err).toBeNull()
expect(users.map(function(u){ return u.username })).toEqual(['john'])
done()
})
}.bind(this))
})
it('executes select query and parses dot notation results', function(done) { it('executes select query and parses dot notation results', function(done) {
this.sequelize.query(this.insertQuery).success(function() { this.sequelize.query(this.insertQuery).success(function() {
this.sequelize this.sequelize
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!