不要怂,就是干,撸起袖子干!

Commit 0de40464 by jonnolen Committed by Jan Aagaard Meier

bug(mssql) Escaping boolean to be 0 or 1 for mssql dialect. Closes #https://gith…

…ub.com/sequelize/sequelize/issues/4619

.
1 parent b503b51e
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- [FIXED] Partial rollback of datatype validations by hiding it behind the `typeValidation` flag. - [FIXED] Partial rollback of datatype validations by hiding it behind the `typeValidation` flag.
- [FIXED] Don't try to select the primary key for models without primary key [#4607](https://github.com/sequelize/sequelize/issues/4607) - [FIXED] Don't try to select the primary key for models without primary key [#4607](https://github.com/sequelize/sequelize/issues/4607)
- [FIXED] Apply `attributes` when including a scoped model. [#4625](https://github.com/sequelize/sequelize/issues/4625) - [FIXED] Apply `attributes` when including a scoped model. [#4625](https://github.com/sequelize/sequelize/issues/4625)
- [FIXED] Use bits instead of strings for mssql booleans. [#4621](https://github.com/sequelize/sequelize/pull/4621)
# 3.11.0 # 3.11.0
- [INTERNALS] Updated dependencies [#4594](https://github.com/sequelize/sequelize/pull/4594) - [INTERNALS] Updated dependencies [#4594](https://github.com/sequelize/sequelize/pull/4594)
......
...@@ -51,10 +51,7 @@ SqlString.escape = function(val, stringifyObjects, timeZone, dialect, field) { ...@@ -51,10 +51,7 @@ SqlString.escape = function(val, stringifyObjects, timeZone, dialect, field) {
// SQLite doesn't have true/false support. MySQL aliases true/false to 1/0 // SQLite doesn't have true/false support. MySQL aliases true/false to 1/0
// for us. Postgres actually has a boolean type with true/false literals, // for us. Postgres actually has a boolean type with true/false literals,
// but sequelize doesn't use it yet. // but sequelize doesn't use it yet.
if (dialect === 'mssql') { if (dialect === 'sqlite' || dialect === 'mssql') {
return "'" + val + "'";
}
if (dialect === 'sqlite') {
return +!!val; return +!!val;
} }
return '' + !!val; return '' + !!val;
......
...@@ -131,7 +131,7 @@ suite(Support.getTestDialectTeaser('SQL'), function() { ...@@ -131,7 +131,7 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
$not: true $not: true
}, { }, {
default: '[deleted] IS NOT true', default: '[deleted] IS NOT true',
mssql: "[deleted] IS NOT 'true'", mssql: "[deleted] IS NOT 1",
sqlite: '`deleted` IS NOT 1' sqlite: '`deleted` IS NOT 1'
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!