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 b2b4fa9b
authored
Sep 26, 2014
by
Jason Jung
Committed by
Matt Broadstone
Dec 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support for delete
1 parent
6307f1dc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
lib/dialects/mssql/query-generator.js
lib/dialects/mssql/sql-generator.js
lib/dialects/mssql/query-generator.js
View file @
b2b4fa9
...
@@ -189,7 +189,11 @@ module.exports = (function() {
...
@@ -189,7 +189,11 @@ module.exports = (function() {
*/
*/
/* istanbul ignore next */
/* istanbul ignore next */
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
throwMethodUndefined
(
'deleteQuery'
);
console
.
log
(
'where:'
,
where
);
var
query
=
SqlGenerator
.
deleteSql
(
tableName
,
where
);
return
query
;
},
},
/*
/*
...
...
lib/dialects/mssql/sql-generator.js
View file @
b2b4fa9
...
@@ -275,6 +275,16 @@ module.exports = {
...
@@ -275,6 +275,16 @@ module.exports = {
return
Utils
.
_
.
template
(
query
)(
replacements
);
return
Utils
.
_
.
template
(
query
)(
replacements
);
},
},
deleteSql
:
function
(
tableName
,
where
)
{
var
query
=
"DELETE FROM <%= table %> <%= where %>"
;
var
replacements
=
{
table
:
tableName
,
where
:
this
.
getWhereClause
(
where
,
tableName
)
};
return
Utils
.
_
.
template
(
query
)(
replacements
);
},
addColumnSql
:
function
(
key
,
dataType
){
addColumnSql
:
function
(
key
,
dataType
){
var
attribute
=
Utils
.
_
.
template
(
'<%= key %> <%= definition %>'
)({
var
attribute
=
Utils
.
_
.
template
(
'<%= key %> <%= definition %>'
)({
key
:
quoteIdentifier
(
key
),
key
:
quoteIdentifier
(
key
),
...
@@ -546,13 +556,16 @@ module.exports = {
...
@@ -546,13 +556,16 @@ module.exports = {
//console.log(where);
//console.log(where);
//console.log(tableName);
//console.log(tableName);
for
(
var
key
in
where
){
for
(
var
key
in
where
){
if
(
tableName
){
var
val
=
where
[
key
];
query
.
push
(
quoteIdentifier
(
tableName
)
+
'.'
+
quoteIdentifier
(
key
));
var
operator
=
'='
;
}
else
{
query
.
push
(
quoteIdentifier
(
key
));
if
(
val
==
'NULL'
)
{
operator
=
'IS'
;
}
}
query
.
push
(
'='
);
query
.
push
(
where
[
key
]);
query
.
push
(
quoteIdentifier
(
tableName
)
+
'.'
+
quoteIdentifier
(
key
));
query
.
push
(
operator
);
query
.
push
(
val
);
}
}
return
query
.
join
(
' '
);
return
query
.
join
(
' '
);
}};
}};
...
...
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