use of com.orm.androrm.statement.Statement in project androrm by androrm.
the class QuerySet method contains.
/**
* Checks if the result of this query contains the given
* object. Note, that this operation will execute the query
* on the database. Use only, if you have to.
*
* @param value
* @return
*/
public boolean contains(T value) {
if (mQuery != null) {
Where where = new Where();
where.setStatement(new Statement(Model.PK, value.getId()));
SelectStatement query = new SelectStatement();
query.from(mQuery).where(where);
return getCount(query) != 0;
}
return false;
}
use of com.orm.androrm.statement.Statement in project androrm by androrm.
the class QuerySet method get.
public T get(int id) {
Where where = new Where();
where.setStatement(new Statement(Model.PK, id));
if (mQuery == null) {
mQuery = new SelectStatement();
mQuery.from(DatabaseBuilder.getTableName(mClass));
}
mQuery.where(where);
Cursor c = getCursor(mQuery);
T object = createObject(c);
closeConnection(c);
return object;
}
Aggregations