当前位置: 首页>>代码示例>>Java>>正文


Java From.execute方法代码示例

本文整理汇总了Java中com.activeandroid.query.From.execute方法的典型用法代码示例。如果您正苦于以下问题:Java From.execute方法的具体用法?Java From.execute怎么用?Java From.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.activeandroid.query.From的用法示例。


在下文中一共展示了From.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 int count = from.count();

    assertEquals(2, count);
    assertEquals(list.size(), count);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:CountTest.java

示例2: testCountGroupBy

import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
 * Should return the total number of rows, even if the rows are grouped. May seem weird, just
 * test it in an SQL explorer.
 */
public void testCountGroupBy() {
    cleanTable();
    populateTable();

    From from = new Select()
            .from(MockModel.class)
            .groupBy("intField")
            .having("intField = 1");

    final List<MockModel> list = from.execute();
    final int count = from.count();

    assertEquals(2, count);
    assertEquals(1, list.size());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:CountTest.java

示例3: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ExistsTest.java

示例4: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ExistsTest.java

示例5: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ExistsTest.java

示例6: getAllAudits

import com.activeandroid.query.From; //导入方法依赖的package包/类
@Override
public List<Audit> getAllAudits(String name, SortCriteria sortCriteria) {
    Timber.v("select all audits name=%s, sortCriteria=%s", name, sortCriteria);
    long now = System.currentTimeMillis();

    From from = new Select()
            .all()
            .from(Audit.class);

    if (StringUtils.isNotBlank(name)) {
        from = from.where(Audit.TABLE_NAME + "." + Audit.COLUMN_NAME + " LIKE ?", "%" + name + "%");
    }

    from = sortCriteria.upgrade(from);
    List<Audit> audits = from.execute();
    for (Audit audit : audits) {
        updateAuditRuleSet(audit);
    }

    Timber.v("select all audits done in %d", System.currentTimeMillis() - now);
    return audits;
}
 
开发者ID:Orange-OpenSource,项目名称:ocara,代码行数:23,代码来源:ModelManagerImpl.java

示例7: searchSites

import com.activeandroid.query.From; //导入方法依赖的package包/类
@Override
public List<Site> searchSites(String noImmo, String name) {
    From from = new Select().from(Site.class);

    if (StringUtils.isNotBlank(noImmo)) {
        from = from.where(Site.COLUMN_NOIMMO + " LIKE ?", "" + noImmo + "%").orderBy(Site.COLUMN_NOIMMO + " ASC");
    }

    if (StringUtils.isNotBlank(name)) {
        from = from.where(Site.COLUMN_NAME + " LIKE ?", "%" + name + "%").orderBy(Site.COLUMN_NAME + " ASC");
    }

    List<Site> sites = from.execute();
    Timber.d("SQL Results : " + sites.size());
    return sites;
}
 
开发者ID:Orange-OpenSource,项目名称:ocara,代码行数:17,代码来源:ModelManagerImpl.java

示例8: testCountTable

import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
 * Should return the same count as there are entries in the result set/table.
 */
public void testCountTable() {
    cleanTable();
    populateTable();

    From from = new Select()
            .from(MockModel.class);

    final List<MockModel> list = from.execute();
    final int count = from.count();

    assertEquals(3, count);
    assertEquals(list.size(), count);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:CountTest.java

示例9: testCountWhereClause

import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
 * Should return the same count as there are entries in the result set if the where-clause
 * matches several entries.
 */
public void testCountWhereClause() {
    cleanTable();
    populateTable();

    From from = new Select()
            .from(MockModel.class)
            .where("intField = ?", 1);

    final List<MockModel> list = from.execute();
    final int count = from.count();

    assertEquals(2, count);
    assertEquals(list.size(), count);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:CountTest.java

示例10: testCountEmptyResult

import com.activeandroid.query.From; //导入方法依赖的package包/类
/**
 * Should return the same count as there are entries in the result set if the where-clause
 * matches zero entries.
 */
public void testCountEmptyResult() {
    cleanTable();
    populateTable();

    From from = new Select()
            .from(MockModel.class)
            .where("intField = ?", 3);

    final List<MockModel> list = from.execute();
    final int count = from.count();

    assertEquals(0, count);
    assertEquals(list.size(), count);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:CountTest.java

示例11: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ExistsTest.java

示例12: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ExistsTest.java

示例13: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ExistsTest.java

示例14: searchAuditors

import com.activeandroid.query.From; //导入方法依赖的package包/类
@Override
public List<Auditor> searchAuditors(String name) {
    From from = new Select().from(Auditor.class);

    if (StringUtils.isNotBlank(name)) {
        from = from.where(Auditor.COLUMN_USER_NAME + " LIKE ?", "%" + name + "%").orderBy(Auditor.COLUMN_USER_NAME + " ASC");
    }

    return from.execute();
}
 
开发者ID:Orange-OpenSource,项目名称:ocara,代码行数:11,代码来源:ModelManagerImpl.java

示例15: getChildrenOf

import com.activeandroid.query.From; //导入方法依赖的package包/类
public static List<Screen> getChildrenOf(long screenId) {
    From where = new Select().from(Screen.class)
            .as("screen")
            .innerJoin(ScreenRelation.class)
            .as("relation")
            .on("screen." + Screen._ID + " = " + "relation.child")
            .where("relation.parent = ?", screenId);
    Log.d(TAG, where.toSql());
    return where
            .execute();
}
 
开发者ID:rockycamacho,项目名称:usbong-builder,代码行数:12,代码来源:Screen.java


注:本文中的com.activeandroid.query.From.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。