/** * Form a compound select with the given query using the EXCEPT operator * * @param query a Query object to append with the EXCEPT operator * @return this Query object, to allow chaining method calls * @see <a href="http://www.sqlite.org/lang_select.html#compound">http://www.sqlite.org/lang_select.html#compound</a> */ public Query except(Query query) { if (immutable) { return fork().except(query); } addCompoundSelect(CompoundSelect.except(query)); return this; }
public void testExcept() { Query query = Query.select().from(Employee.TABLE).where(Employee.MANAGER_ID.eq(1)) .except(Query.select().from(Employee.TABLE).where(Employee.ID.eq(2))) .orderBy(Employee.ID.asc()); SquidCursor<Employee> cursor = database.query(Employee.class, query); try { assertEquals(2, cursor.getCount()); cursor.moveToFirst(); assertEquals(elmo, new Employee(cursor)); cursor.moveToNext(); assertEquals(oscar, new Employee(cursor)); } finally { cursor.close(); } }
/** * Form a compound select with the given query using the EXCEPT operator * * @param query a Query object to append with the EXCEPT operator * @return this Query object, to allow chaining method calls * @see <a href="http://www.sqlite.org/lang_select.html#compound">http://www.sqlite.org/lang_select.html#compound</a> */ public Query except(Query query) { if (immutable) { return fork().except(query); } addCompoundSelect(CompoundSelect.except(query)); return this; }