Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 16faae84
authored
Jul 07, 2013
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only use quoteidentifiers when raw query is false
1 parent
e80cf3a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
lib/dialects/postgres/query.js
spec/sequelize.spec.js
lib/dialects/postgres/query.js
View file @
16faae8
...
@@ -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
)
{
...
...
spec/sequelize.spec.js
View file @
16faae8
...
@@ -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
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment