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 54e12fcd
authored
Oct 01, 2014
by
Joel Trost
Committed by
Matt Broadstone
Dec 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Count
1 parent
db45f14f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
lib/dialects/mssql/query-generator.js
lib/dialects/mssql/sql-generator.js
lib/dialects/mssql/query-generator.js
View file @
54e12fc
...
@@ -418,10 +418,13 @@ module.exports = (function() {
...
@@ -418,10 +418,13 @@ module.exports = (function() {
//console.log('model', model.name);
//console.log('model', model.name);
//console.log(options.where);
//console.log(options.where);
options
=
options
||
{};
options
=
options
||
{};
var
query
=
[
var
query
=
[];
SqlGenerator
.
getSelectorClause
(
model
,
options
),
if
(
options
.
attributes
[
0
][
0
].
fn
===
'COUNT'
){
SqlGenerator
.
getFromClause
(
model
.
tableName
,
model
.
name
)
query
.
push
(
SqlGenerator
.
getCountClause
(
'COUNT'
,
options
.
attributes
[
0
][
0
].
args
[
0
].
col
));
];
}
else
{
query
.
push
(
SqlGenerator
.
getSelectorClause
(
model
,
options
));
}
query
.
push
(
SqlGenerator
.
getFromClause
(
model
.
tableName
,
model
.
name
));
if
(
options
.
include
){
if
(
options
.
include
){
for
(
var
i
=
0
;
i
<
options
.
include
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
options
.
include
.
length
;
i
++
){
...
@@ -462,7 +465,7 @@ module.exports = (function() {
...
@@ -462,7 +465,7 @@ module.exports = (function() {
/**
/**
* Returns a query that starts a transaction.
* Returns a query that starts a transaction.
*
*
* @param {Transaction} transaction
* @param {Transaction} transaction
g
* @param {Object} options An object with options.
* @param {Object} options An object with options.
* @return {String} The generated sql query.
* @return {String} The generated sql query.
*/
*/
...
@@ -471,7 +474,6 @@ module.exports = (function() {
...
@@ -471,7 +474,6 @@ module.exports = (function() {
return
''
;
return
''
;
//return 'SAVE TRANSACTION ' + SqlGenerator.quoteIdentifier(transaction.name) + ';';
//return 'SAVE TRANSACTION ' + SqlGenerator.quoteIdentifier(transaction.name) + ';';
}
}
// return 'BEGIN TRANSACTION';
// return 'BEGIN TRANSACTION';
return
''
;
return
''
;
},
},
...
...
lib/dialects/mssql/sql-generator.js
View file @
54e12fc
...
@@ -522,6 +522,13 @@ module.exports = {
...
@@ -522,6 +522,13 @@ module.exports = {
getTopClause
:
function
(
limit
){
getTopClause
:
function
(
limit
){
return
"TOP("
+
limit
+
")"
;
return
"TOP("
+
limit
+
")"
;
},
},
getCountClause
:
function
(
alias
,
columnName
){
return
[
"SELECT COUNT("
,
columnName
,
") AS"
,
quoteIdentifier
(
alias
)
].
join
(
' '
);
},
getSelectorClause
:
function
(
model
,
options
){
getSelectorClause
:
function
(
model
,
options
){
var
query
=
[
'SELECT'
];
var
query
=
[
'SELECT'
];
//we have joins
//we have joins
...
...
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