* Remove parentheses from AS
when renaming raw expressions
.
This commit is contained in:
parent
4cdded0d87
commit
e90bba935e
3 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,6 @@
|
|||
# 2.1.0-beta.3
|
||||
* Remove parentheses from `AS` when renaming raw `expressions`.
|
||||
|
||||
# 2.1.0-beta.2
|
||||
* Add `expressions` to `Query`, to support custom SQL expressions that are
|
||||
read as normal fields.
|
||||
|
|
|
@ -42,7 +42,8 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
|||
/// Preprends the [tableName] to the [String], [s].
|
||||
String adornWithTableName(String s) {
|
||||
if (expressions.containsKey(s)) {
|
||||
return '(${expressions[s]} AS $s)';
|
||||
return '${expressions[s]} AS $s';
|
||||
// return '(${expressions[s]} AS $s)';
|
||||
} else {
|
||||
return '$tableName.$s';
|
||||
}
|
||||
|
@ -256,13 +257,15 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
|||
ss = '$ss AS ${aliases[s]}';
|
||||
}
|
||||
if (expressions.containsKey(s)) {
|
||||
ss = '($ss)';
|
||||
// ss = '($ss)';
|
||||
}
|
||||
} else if (expressions.containsKey(s)) {
|
||||
if (cast != null) {
|
||||
ss = '(($ss) AS $s)';
|
||||
ss = '($ss) AS $s';
|
||||
// ss = '(($ss) AS $s)';
|
||||
} else {
|
||||
ss = '($ss AS $s)';
|
||||
ss = '$ss AS $s';
|
||||
// ss = '($ss AS $s)';
|
||||
}
|
||||
}
|
||||
return ss;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_orm
|
||||
version: 2.1.0-beta.2
|
||||
version: 2.1.0-beta.3
|
||||
description: Runtime support for Angel's ORM. Includes base classes for queries.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/orm
|
||||
|
|
Loading…
Reference in a new issue