/** Fetch all metadata that are unattached to the task */ public TodorooCursor<Metadata> fetchDangling(Property<?>... properties) { Query sql = Query.select(properties) .from(Metadata.TABLE) .join(Join.left(Task.TABLE, Metadata.TASK.eq(Task.ID))) .where(Task.TITLE.isNull()); Cursor cursor = database.rawQuery(sql.toString(), null); return new TodorooCursor<Metadata>(cursor, properties); }
/** * Construct a query with SQL DSL objects * * @param query * @return */ public TodorooCursor<TYPE> query(Query query) { query.from(table); if (debug) Log.i("SQL-" + modelClass.getSimpleName(), query.toString()); // $NON-NLS-1$ Cursor cursor = database.rawQuery(query.toString(), null); return new TodorooCursor<TYPE>(cursor, query.getFields()); }