本文整理汇总了Java中com.activeandroid.query.From.exists方法的典型用法代码示例。如果您正苦于以下问题:Java From.exists方法的具体用法?Java From.exists怎么用?Java From.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.activeandroid.query.From
的用法示例。
在下文中一共展示了From.exists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCountOrderBy
import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
* Should not change the result if order by is used.
*/
public void testCountOrderBy() {
cleanTable();
populateTable();
From from = new Select()
.from(MockModel.class)
.where("intField = ?", 1)
.orderBy("intField ASC");
final List<MockModel> list = from.execute();
final boolean exists = from.exists();
assertTrue(exists);
assertTrue(list.size() > 0);
}
示例2: testCountGroupBy
import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
* Should not change the result if group by is used.
*/
public void testCountGroupBy() {
cleanTable();
populateTable();
From from = new Select()
.from(MockModel.class)
.groupBy("intField")
.having("intField = 1");
final List<MockModel> list = from.execute();
final boolean exists = from.exists();
assertTrue(exists);
assertTrue(list.size() > 0);
}
示例3: testCountGroupByEmpty
import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
* Should not exist if group by eliminates all rows.
*/
public void testCountGroupByEmpty() {
cleanTable();
populateTable();
From from = new Select()
.from(MockModel.class)
.groupBy("intField")
.having("intField = 3");
final List<MockModel> list = from.execute();
final boolean exists = from.exists();
assertFalse(exists);
assertFalse(list.size() > 0);
}
示例4: checkAuditExistenceByNameAndVersion
import com.activeandroid.query.From; //导入方法依赖的package包/类
@Override
public boolean checkAuditExistenceByNameAndVersion(String name, Site site, int version) {
Timber.v("audit check existence : name %s version %d ", name, version);
From from = new Select().from(Audit.class)
.where(Audit.COLUMN_NAME + " = ?", name);
if (version != 0) {
from = from.and(Audit.COLUMN_VERSION + " = ?", version);
}
from = from.and(Audit.COLUMN_SITE + " = ?", site.getId());
boolean result = from.exists();
Timber.v("audit check existence retrieved : %b", result);
return result;
}
示例5: testExistsTable
import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
* Should return {@code true} since the result set/table isn't empty.
*/
public void testExistsTable() {
cleanTable();
populateTable();
From from = new Select()
.from(MockModel.class);
final List<MockModel> list = from.execute();
final boolean exists = from.exists();
assertTrue(exists);
assertTrue(list.size() > 0);
}
示例6: testExistsWhereClause
import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
* Should return {@code true} since the where-clause matches rows and thus the result set isn't
* empty.
*/
public void testExistsWhereClause() {
cleanTable();
populateTable();
From from = new Select()
.from(MockModel.class)
.where("intField = ?", 1);
final List<MockModel> list = from.execute();
final boolean exists = from.exists();
assertTrue(exists);
assertTrue(list.size() > 0);
}
示例7: testExistsEmptyResult
import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
* Should return {@code false} since the where-clause matches zero rows and thus the result set
* is empty.
*/
public void testExistsEmptyResult() {
cleanTable();
populateTable();
From from = new Select()
.from(MockModel.class)
.where("intField = ?", 3);
final List<MockModel> list = from.execute();
final boolean exists = from.exists();
assertFalse(exists);
assertFalse(list.size() > 0);
}
示例8: checkSiteExistenceByNoImmo
import com.activeandroid.query.From; //导入方法依赖的package包/类
public boolean checkSiteExistenceByNoImmo(String noImmo) {
Timber.v("site check existence : NoImmo %s", noImmo);
From from = new Select().from(Site.class);
if (StringUtils.isNotBlank(noImmo)) {
from = from.where(Site.COLUMN_NOIMMO + " = ?", noImmo);
}
boolean result = from.exists();
Timber.v("site check existence retrieved : %b", result);
return result;
}
示例9: checkSiteExistenceByName
import com.activeandroid.query.From; //导入方法依赖的package包/类
public boolean checkSiteExistenceByName(String name) {
Timber.v("site check existence : Name %s ", name);
From from = new Select().from(Site.class);
if (StringUtils.isNotBlank(name)) {
from = from.where(Site.COLUMN_NAME + " = ?", name);
}
boolean result = from.exists();
Timber.v("site check existence retrieved : %b", result);
return result;
}