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 d1b914f7
authored
Nov 16, 2014
by
Matt Broadstone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove faulty logic in update code
1 parent
69dc2200
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
lib/dialects/mssql/query-generator.js
lib/dialects/mssql/query-generator.js
View file @
d1b914f
...
...
@@ -226,30 +226,28 @@ module.exports = (function() {
var
query
;
attrValueHash
=
Utils
.
removeNullValuesFromHash
(
attrValueHash
,
false
,
options
);
//very unique case for cascades, i generally don't approve
if
(
Object
.
keys
(
attrValueHash
).
length
===
1
&&
attributes
[
Object
.
keys
(
attrValueHash
)[
0
]].
primaryKey
){
this
.
sequelize
.
log
(
'Updating a Primary Key is not supported in MSSQL, please restructure your query'
);
}
else
{
for
(
var
key
in
attributes
){
var
aliasKey
=
attributes
[
key
].
field
||
key
;
if
(
attributes
[
key
].
primaryKey
&&
attrValueHash
[
aliasKey
]){
delete
attrValueHash
[
aliasKey
];
}
if
(
attrValueHash
[
aliasKey
]
&&
attrValueHash
[
aliasKey
].
fn
){
}
for
(
var
key
in
attributes
)
{
var
aliasKey
=
attributes
[
key
].
field
||
key
;
if
(
attributes
[
key
].
primaryKey
&&
attrValueHash
[
aliasKey
])
{
delete
attrValueHash
[
aliasKey
];
}
if
(
!
Object
.
keys
(
attrValueHash
).
length
){
return
''
;
//return ['SELECT * FROM ', tableName, 'WHERE', this.getWhereConditions(where) + ';'].join(' ');
if
(
attrValueHash
[
aliasKey
]
&&
attrValueHash
[
aliasKey
].
fn
)
{
}
query
=
[
SqlGenerator
.
updateSql
(
tableName
,
attrValueHash
,
attributes
),
'WHERE'
,
this
.
getWhereConditions
(
where
)
].
join
(
' '
)
+
';'
;
}
if
(
!
Object
.
keys
(
attrValueHash
).
length
)
{
return
''
;
//return ['SELECT * FROM ', tableName, 'WHERE', this.getWhereConditions(where) + ';'].join(' ');
}
query
=
[
SqlGenerator
.
updateSql
(
tableName
,
attrValueHash
,
attributes
),
'WHERE'
,
this
.
getWhereConditions
(
where
)
].
join
(
' '
)
+
';'
;
return
query
;
},
...
...
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