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 74f07b6c
authored
May 21, 2015
by
Pedro Miguel Henriques Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MSSQL] Eliminate duplicate ORDER BY statements in select queries
Fixes #3489 and closes #3490.
1 parent
c1bb8aef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
lib/dialects/mssql/query-generator.js
test/integration/model/findAll.test.js
lib/dialects/mssql/query-generator.js
View file @
74f07b6
...
...
@@ -570,7 +570,14 @@ module.exports = (function() {
if
(
options
.
limit
||
options
.
offset
)
{
if
(
!
options
.
order
||
(
options
.
include
&&
!
subQueryOrder
.
length
))
{
fragment
+=
' ORDER BY '
+
this
.
quoteIdentifier
(
model
.
primaryKeyAttribute
);
if
(
!
isSubQuery
&&
options
.
order
)
{
fragment
+=
', '
;
}
else
{
fragment
+=
' ORDER BY '
;
}
fragment
+=
this
.
quoteIdentifier
(
model
.
primaryKeyAttribute
);
}
if
(
options
.
offset
||
options
.
limit
)
{
...
...
test/integration/model/findAll.test.js
View file @
74f07b6
...
...
@@ -562,6 +562,19 @@ describe(Support.getTestDialectTeaser('Model'), function() {
expect
(
tasks
[
0
].
Worker
.
name
).
to
.
equal
(
'worker'
);
});
});
it
(
'returns the associated worker via task.worker, using limit and sort'
,
function
()
{
return
this
.
Task
.
findAll
({
where
:
{
title
:
'homework'
},
include
:
[
this
.
Worker
],
limit
:
1
,
order
:
'title DESC'
}).
then
(
function
(
tasks
)
{
expect
(
tasks
).
to
.
exist
;
expect
(
tasks
[
0
].
Worker
).
to
.
exist
;
expect
(
tasks
[
0
].
Worker
.
name
).
to
.
equal
(
'worker'
);
});
});
});
describe
(
'hasOne'
,
function
()
{
...
...
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