use of com.orm.androrm.Where in project androrm by androrm.
the class WhereTest method testSimpleConstraint.
public void testSimpleConstraint() {
Where where = new Where();
where.and("foo", "bar");
assertEquals(" WHERE foo = 'bar'", where.toString());
where = new Where();
where.or("foo", "bar");
assertEquals(" WHERE foo = 'bar'", where.toString());
}
use of com.orm.androrm.Where in project androrm by androrm.
the class WhereTest method testEmptyWhere.
public void testEmptyWhere() {
Where where = new Where();
assertNull(where.toString());
}
use of com.orm.androrm.Where in project androrm by androrm.
the class WhereTest method testAddOr.
public void testAddOr() {
Where where = new Where();
where.or("foo", "bar").or("bar", "baz");
assertEquals(" WHERE (foo = 'bar' OR bar = 'baz')", where.toString());
}
use of com.orm.androrm.Where in project androrm by androrm.
the class WhereTest method testAddAnd.
public void testAddAnd() {
Where where = new Where();
where.and("foo", "bar").and("bar", "baz");
assertEquals(" WHERE foo = 'bar' AND bar = 'baz'", where.toString());
}
use of com.orm.androrm.Where in project androrm by androrm.
the class ManyToManyField method getRightJoinSide.
private SelectStatement getRightJoinSide(int id) {
String leftTable = DatabaseBuilder.getTableName(mOriginClass);
String rightTable = DatabaseBuilder.getTableName(mTargetClass);
Where where = new Where();
where.setStatement(new Statement(leftTable, id));
SelectStatement relation = new SelectStatement();
relation.from(mTableName).select(leftTable, rightTable).where(where);
JoinStatement join = new JoinStatement();
join.left(relation, "left").right(rightTable, "right").on(rightTable, Model.PK);
SelectStatement select = new SelectStatement();
select.from(join).select("left." + rightTable + " AS " + rightTable);
return select;
}
Aggregations