and, or, not in QueryWhere include parentheses.

This commit is contained in:
Tobe O 2019-08-17 18:18:39 -04:00
parent f18c23c5f9
commit a05f15b3df
2 changed files with 4 additions and 3 deletions

View file

@ -7,6 +7,7 @@ callbacks.
ORM queries to reference their joined subqueries.
* Removed deprecated `Join`, `toSql`, `sanitizeExpression`, `isAscii`.
* Always put `ORDER BY` before `LIMIT`.
* `and`, `or`, `not` in `QueryWhere` include parentheses.
# 2.0.1
* Apply `package:pedantic` fixes.

View file

@ -41,17 +41,17 @@ abstract class QueryWhere {
for (var other in _and) {
var sql = other.compile();
if (sql.isNotEmpty) b.write(' AND $sql');
if (sql.isNotEmpty) b.write(' AND ($sql)');
}
for (var other in _not) {
var sql = other.compile();
if (sql.isNotEmpty) b.write(' NOT $sql');
if (sql.isNotEmpty) b.write(' NOT ($sql)');
}
for (var other in _or) {
var sql = other.compile();
if (sql.isNotEmpty) b.write(' OR $sql');
if (sql.isNotEmpty) b.write(' OR ($sql)');
}
return b.toString();