@Test public void testOrderByRaw() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); foo1.val = 1; foo1.equal = 10; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); foo2.val = 5; foo2.equal = 7; assertEquals(1, dao.create(foo2)); List<Foo> results = dao.queryBuilder() .orderByRaw("(" + Foo.VAL_COLUMN_NAME + "+" + Foo.EQUAL_COLUMN_NAME + ") DESC") .query(); assertEquals(2, results.size()); assertEquals(foo2.id, results.get(0).id); assertEquals(foo1.id, results.get(1).id); }
public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; } }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); PreparedQuery<T> prepare(); QueryBuilder<T, ID> selectColumns(String... columns); QueryBuilder<T, ID> selectColumns(Iterable<String> columns); QueryBuilder<T, ID> selectRaw(String... columns); QueryBuilder<T, ID> groupBy(String columnName); QueryBuilder<T, ID> groupByRaw(String rawSql); QueryBuilder<T, ID> orderBy(String columnName, boolean ascending); QueryBuilder<T, ID> orderByRaw(String rawSql); QueryBuilder<T, ID> orderByRaw(String rawSql, ArgumentHolder... args); QueryBuilder<T, ID> distinct(); QueryBuilder<T, ID> limit(Long maxRows); QueryBuilder<T, ID> offset(Long startRow); QueryBuilder<T, ID> setCountOf(boolean countOf); QueryBuilder<T, ID> setCountOf(String countOfQuery); QueryBuilder<T, ID> having(String having); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); QueryBuilder<T, ID> joinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); List<T> query(); GenericRawResults<String[]> queryRaw(); T queryForFirst(); String[] queryRawFirst(); CloseableIterator<T> iterator(); long countOf(); long countOf(String countOfQuery); QueryBuilder<T, ID> setAlias(String alias); @Override void reset(); }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> orderByRaw(String rawSql) { addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null)); return this; } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); PreparedQuery<T> prepare(); QueryBuilder<T, ID> selectColumns(String... columns); QueryBuilder<T, ID> selectColumns(Iterable<String> columns); QueryBuilder<T, ID> selectRaw(String... columns); QueryBuilder<T, ID> groupBy(String columnName); QueryBuilder<T, ID> groupByRaw(String rawSql); QueryBuilder<T, ID> orderBy(String columnName, boolean ascending); QueryBuilder<T, ID> orderByRaw(String rawSql); QueryBuilder<T, ID> orderByRaw(String rawSql, ArgumentHolder... args); QueryBuilder<T, ID> distinct(); QueryBuilder<T, ID> limit(Long maxRows); QueryBuilder<T, ID> offset(Long startRow); QueryBuilder<T, ID> setCountOf(boolean countOf); QueryBuilder<T, ID> setCountOf(String countOfQuery); QueryBuilder<T, ID> having(String having); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); QueryBuilder<T, ID> joinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); List<T> query(); GenericRawResults<String[]> queryRaw(); T queryForFirst(); String[] queryRawFirst(); CloseableIterator<T> iterator(); long countOf(); long countOf(String countOfQuery); QueryBuilder<T, ID> setAlias(String alias); @Override void reset();  }