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 93afadd6
authored
Dec 04, 2014
by
Matt Broadstone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use incrementQuery from abstract dialect
1 parent
b7924c95
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
62 deletions
lib/dialects/mssql/query-generator.js
lib/dialects/mssql/sql-generator.js
lib/dialects/mssql/query-generator.js
View file @
93afadd
...
@@ -203,36 +203,6 @@ module.exports = (function() {
...
@@ -203,36 +203,6 @@ module.exports = (function() {
return
query
;
return
query
;
},
},
incrementQuery
:
function
(
tableName
,
attrValueHash
,
where
,
options
,
attributes
)
{
attrValueHash
=
Utils
.
removeNullValuesFromHash
(
attrValueHash
,
false
,
options
);
for
(
var
key
in
attributes
)
{
if
(
attributes
[
key
].
primaryKey
&&
attrValueHash
[
key
])
{
delete
attrValueHash
[
key
];
}
attrValueHash
[
key
]
+=
1
;
}
for
(
key
in
options
)
{
if
(
key
===
'allowNull'
)
{
delete
options
[
key
];
}
}
if
(
!
Object
.
keys
(
attrValueHash
).
length
)
{
return
''
;
//return ['SELECT * FROM ', tableName, 'WHERE', this.getWhereConditions(where) + ';'].join(' ');
}
var
query
=
[
SqlGenerator
.
incrementSql
(
tableName
,
attrValueHash
,
options
),
'WHERE'
,
this
.
getWhereConditions
(
where
)
].
join
(
' '
)
+
';'
;
return
query
;
},
showIndexQuery
:
function
(
tableName
,
options
)
{
showIndexQuery
:
function
(
tableName
,
options
)
{
// FIXME: temporary until I implement proper schema support
// FIXME: temporary until I implement proper schema support
var
dequotedTableName
=
tableName
.
toString
().
replace
(
/
[
'"
]
+/g
,
''
);
var
dequotedTableName
=
tableName
.
toString
().
replace
(
/
[
'"
]
+/g
,
''
);
...
...
lib/dialects/mssql/sql-generator.js
View file @
93afadd
...
@@ -132,38 +132,6 @@ module.exports = {
...
@@ -132,38 +132,6 @@ module.exports = {
return
Utils
.
_
.
template
(
query
)(
value
);
return
Utils
.
_
.
template
(
query
)(
value
);
},
},
incrementSql
:
function
(
tableName
,
attrValueHash
,
options
)
{
attrValueHash
=
Utils
.
removeNullValuesFromHash
(
attrValueHash
,
this
.
options
.
omitNull
);
var
query
,
key
,
value
,
selFields
=
[]
,
values
=
[];
query
=
'UPDATE <%= table %> SET <%= values %> OUTPUT <%= selFields %>'
;
for
(
key
in
attrValueHash
)
{
value
=
attrValueHash
[
key
];
values
.
push
(
quoteIdentifier
(
key
)
+
'='
+
quoteIdentifier
(
key
)
+
' + '
+
escape
(
value
));
selFields
.
push
(
'INSERTED.'
+
quoteIdentifier
(
key
));
}
options
=
options
||
{};
for
(
key
in
options
)
{
value
=
options
[
key
];
values
.
push
(
quoteIdentifier
(
key
)
+
'='
+
escape
(
value
));
}
var
replacements
=
{
table
:
quoteIdentifiers
(
tableName
),
values
:
values
.
join
(
','
),
selFields
:
selFields
.
join
(
','
)
};
return
Utils
.
_
.
template
(
query
)(
replacements
);
},
deleteSql
:
function
(
tableName
)
{
deleteSql
:
function
(
tableName
)
{
var
query
=
"DELETE FROM <%= table %>"
;
var
query
=
"DELETE FROM <%= table %>"
;
var
replacements
=
{
var
replacements
=
{
...
...
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