Update test cases
This commit is contained in:
parent
0addba99d3
commit
370df62fb6
3 changed files with 14 additions and 6 deletions
|
@ -37,7 +37,7 @@
|
||||||
* Migrated angel_orm_generator to 4.0.0 (0/0 tests passed)
|
* Migrated angel_orm_generator to 4.0.0 (0/0 tests passed)
|
||||||
* Migrated angel_migration_runner to 3.0.0 (0/0 tests passed)
|
* Migrated angel_migration_runner to 3.0.0 (0/0 tests passed)
|
||||||
* Migrated angel_orm_test to 3.0.0 (0/0 tests passed)
|
* Migrated angel_orm_test to 3.0.0 (0/0 tests passed)
|
||||||
* Migrated angel_orm_postgres to 3.0.0 (44/54 tests passed)
|
* Migrated angel_orm_postgres to 3.0.0 (45/54 tests passed)
|
||||||
* Update orm-sdk-2.12.x boilerplate (in progress) <= Milestone 2
|
* Update orm-sdk-2.12.x boilerplate (in progress) <= Milestone 2
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class JoinBuilder {
|
||||||
|
|
||||||
/// A callback to produces the expression to join against, i.e.
|
/// A callback to produces the expression to join against, i.e.
|
||||||
/// a table name, or the result of compiling a query.
|
/// a table name, or the result of compiling a query.
|
||||||
final String? Function() to;
|
final String Function() to;
|
||||||
final List<String> additionalFields;
|
final List<String> additionalFields;
|
||||||
|
|
||||||
JoinBuilder(this.type, this.from, this.to, this.key, this.value,
|
JoinBuilder(this.type, this.from, this.to, this.key, this.value,
|
||||||
|
@ -39,9 +39,12 @@ class JoinBuilder {
|
||||||
return right;
|
return right;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? compile(Set<String>? trampoline) {
|
String compile(Set<String>? trampoline) {
|
||||||
var compiledTo = to();
|
var compiledTo = to();
|
||||||
if (compiledTo == null) return null;
|
//if (compiledTo == null) return null;
|
||||||
|
if (compiledTo == '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
var b = StringBuffer();
|
var b = StringBuffer();
|
||||||
var left = '${from.tableName}.$key';
|
var left = '${from.tableName}.$key';
|
||||||
var right = fieldName;
|
var right = fieldName;
|
||||||
|
|
|
@ -148,6 +148,9 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
||||||
return () {
|
return () {
|
||||||
var c = tableName.compile(trampoline);
|
var c = tableName.compile(trampoline);
|
||||||
//if (c == null) return c;
|
//if (c == null) return c;
|
||||||
|
if (c == '') {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
return '($c)';
|
return '($c)';
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -241,7 +244,8 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
||||||
// One table MAY appear multiple times in a query.
|
// One table MAY appear multiple times in a query.
|
||||||
if (!canCompile(trampoline)) {
|
if (!canCompile(trampoline)) {
|
||||||
//return null;
|
//return null;
|
||||||
throw Exception('One table appear multiple times in a query');
|
//throw Exception('One table appear multiple times in a query');
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
includeTableName = includeTableName || _joins.isNotEmpty;
|
includeTableName = includeTableName || _joins.isNotEmpty;
|
||||||
|
@ -285,7 +289,8 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
||||||
}));
|
}));
|
||||||
_joins.forEach((j) {
|
_joins.forEach((j) {
|
||||||
var c = compiledJoins[j] = j.compile(trampoline);
|
var c = compiledJoins[j] = j.compile(trampoline);
|
||||||
if (c != null) {
|
//if (c != null) {
|
||||||
|
if (c != '') {
|
||||||
var additional = j.additionalFields.map(j.nameFor).toList();
|
var additional = j.additionalFields.map(j.nameFor).toList();
|
||||||
f.addAll(additional);
|
f.addAll(additional);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue