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 35fe16f5
authored
Mar 05, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sislab' of
git://github.com/sislab/sequelize
into sislab-sislab
2 parents
197a0fb0
6bc272bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
2 deletions
lib/dialects/mysql/query-generator.js
lib/dialects/postgres/query-generator.js
spec-jasmine/mysql/query-generator.spec.js
spec-jasmine/postgres/query-generator.spec.js
lib/dialects/mysql/query-generator.js
View file @
35fe16f
...
@@ -159,7 +159,7 @@ module.exports = (function() {
...
@@ -159,7 +159,7 @@ module.exports = (function() {
}
}
if
(
options
.
group
)
{
if
(
options
.
group
)
{
options
.
group
=
Utils
.
addTicks
(
options
.
group
)
options
.
group
=
Array
.
isArray
(
options
.
group
)
?
options
.
group
.
map
(
function
(
grp
){
return
Utils
.
addTicks
(
grp
)}).
join
(
', '
)
:
Utils
.
addTicks
(
options
.
group
)
query
+=
" GROUP BY <%= group %>"
query
+=
" GROUP BY <%= group %>"
}
}
...
...
lib/dialects/postgres/query-generator.js
View file @
35fe16f
...
@@ -285,7 +285,7 @@ module.exports = (function() {
...
@@ -285,7 +285,7 @@ module.exports = (function() {
}
}
if
(
options
.
group
)
{
if
(
options
.
group
)
{
options
.
group
=
addQuotes
(
options
.
group
)
options
.
group
=
Array
.
isArray
(
options
.
group
)
?
options
.
group
.
map
(
function
(
grp
){
return
addQuotes
(
grp
)}).
join
(
', '
)
:
addQuotes
(
options
.
group
)
query
+=
" GROUP BY <%= group %>"
query
+=
" GROUP BY <%= group %>"
}
}
...
...
spec-jasmine/mysql/query-generator.spec.js
View file @
35fe16f
...
@@ -78,6 +78,14 @@ describe('QueryGenerator', function() {
...
@@ -78,6 +78,14 @@ describe('QueryGenerator', function() {
expectation
:
"SELECT * FROM `myTable` GROUP BY `name`;"
,
expectation
:
"SELECT * FROM `myTable` GROUP BY `name`;"
,
context
:
QueryGenerator
context
:
QueryGenerator
},
{
},
{
arguments
:
[
'myTable'
,
{
group
:
[
"name"
]}],
expectation
:
"SELECT * FROM `myTable` GROUP BY `name`;"
,
context
:
QueryGenerator
},
{
arguments
:
[
'myTable'
,
{
group
:
[
"name"
,
"title"
]}],
expectation
:
"SELECT * FROM `myTable` GROUP BY `name`, `title`;"
,
context
:
QueryGenerator
},
{
arguments
:
[
'myTable'
,
{
group
:
"name"
,
order
:
"id DESC"
}],
arguments
:
[
'myTable'
,
{
group
:
"name"
,
order
:
"id DESC"
}],
expectation
:
"SELECT * FROM `myTable` GROUP BY `name` ORDER BY id DESC;"
,
expectation
:
"SELECT * FROM `myTable` GROUP BY `name` ORDER BY id DESC;"
,
context
:
QueryGenerator
context
:
QueryGenerator
...
...
spec-jasmine/postgres/query-generator.spec.js
View file @
35fe16f
...
@@ -72,6 +72,12 @@ describe('QueryGenerator', function() {
...
@@ -72,6 +72,12 @@ describe('QueryGenerator', function() {
arguments
:
[
'myTable'
,
{
group
:
"name"
}],
arguments
:
[
'myTable'
,
{
group
:
"name"
}],
expectation
:
"SELECT * FROM \"myTable\" GROUP BY \"name\";"
expectation
:
"SELECT * FROM \"myTable\" GROUP BY \"name\";"
},
{
},
{
arguments
:
[
'myTable'
,
{
group
:
[
"name"
]}],
expectation
:
"SELECT * FROM \"myTable\" GROUP BY \"name\";"
},
{
arguments
:
[
'myTable'
,
{
group
:
[
"name"
,
"title"
]}],
expectation
:
"SELECT * FROM \"myTable\" GROUP BY \"name\", \"title\";"
},
{
arguments
:
[
'myTable'
,
{
limit
:
10
}],
arguments
:
[
'myTable'
,
{
limit
:
10
}],
expectation
:
"SELECT * FROM \"myTable\" LIMIT 10;"
expectation
:
"SELECT * FROM \"myTable\" LIMIT 10;"
},
{
},
{
...
...
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