當前位置: 首頁>>代碼示例>>Java>>正文


Java Where.eq方法代碼示例

本文整理匯總了Java中com.j256.ormlite.stmt.Where.eq方法的典型用法代碼示例。如果您正苦於以下問題:Java Where.eq方法的具體用法?Java Where.eq怎麽用?Java Where.eq使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.j256.ormlite.stmt.Where的用法示例。


在下文中一共展示了Where.eq方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTag

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public Tag getTag(final String aTag) {
    try {
        QueryBuilder<Tag, Long> queryBuilder = dbHelper.getTagDao().queryBuilder();
        Where<Tag, Long> where = queryBuilder.where();
        SelectArg selectArg = new SelectArg();

        // define our query as 'name = ?'
        where.eq(Tag.COLUMN_NAME_TITLE, selectArg);

        // prepare it so it is ready for later query or iterator calls
        PreparedQuery<Tag> preparedQuery = queryBuilder.prepare();

        // later we can set the select argument and issue the query
        selectArg.setValue(aTag);
        List<Tag> tgs = dbHelper.getTagDao().query(preparedQuery);
        if (!tgs.isEmpty()) {
            return tgs.get(0);
        }
    } catch (java.sql.SQLException pE) {
        pE.printStackTrace();
    }
    return null;
}
 
開發者ID:mrspaceman,項目名稱:ebookmgr,代碼行數:24,代碼來源:LibraryManager.java

示例2: getBook

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public EBook getBook(final String fullFilename) {
    EBook ebk = null;
    try {
        QueryBuilder<EBook, Long> queryBuilder = dbHelper.getEBookDao().queryBuilder();
        Where<EBook, Long> where = queryBuilder.where();
        SelectArg selectArg = new SelectArg();

        // define our query as 'name = ?'
        where.eq(EBook.COLUMN_FULL_FILE_NAME, selectArg);

        // prepare it so it is ready for later query or iterator calls
        PreparedQuery<EBook> preparedQuery = queryBuilder.prepare();

        // later we can set the select argument and issue the query
        selectArg.setValue(fullFilename);
        List<EBook> result = dbHelper.getEBookDao().query(preparedQuery);

        if (result.size() > 0) {
            ebk = result.get(0);
        }
    } catch (java.sql.SQLException pE) {
        BookLibApplication.getInstance().e("Exception reading ebooks", pE);
    }
    return ebk;
}
 
開發者ID:mrspaceman,項目名稱:ebookmgr,代碼行數:26,代碼來源:LibraryManager.java

示例3: getFileType

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public FileType getFileType(final String aFileType) {
    try {
        QueryBuilder<FileType, Long> queryBuilder = dbHelper.getFileTypeDao().queryBuilder();
        Where<FileType, Long> where = queryBuilder.where();
        SelectArg selectArg = new SelectArg();

        // define our query as 'name = ?'
        where.eq(FileType.COLUMN_NAME_TITLE, selectArg);

        // prepare it so it is ready for later query or iterator calls
        PreparedQuery<FileType> preparedQuery = queryBuilder.prepare();

        // later we can set the select argument and issue the query
        selectArg.setValue(aFileType);
        List<FileType> tgs = dbHelper.getFileTypeDao().query(preparedQuery);
        if (!tgs.isEmpty()) {
            return tgs.get(0);
        }
    } catch (java.sql.SQLException pE) {
        pE.printStackTrace();
    }
    return null;
}
 
開發者ID:mrspaceman,項目名稱:ebookmgr,代碼行數:24,代碼來源:LibraryManager.java

示例4: getAuthor

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public Author getAuthor(final String pFirstname, final String pLastname) {
    try {
        QueryBuilder<Author, Long> queryBuilder = dbHelper.getAuthorDao().queryBuilder();
        Where<Author, Long> where = queryBuilder.where();
        SelectArg selectArg = new SelectArg();

        // define our query as 'name = ?'
        where.eq(Author.COLUMN_NAME_FIRSTNAME, selectArg);

        // prepare it so it is ready for later query or iterator calls
        PreparedQuery<Author> preparedQuery = queryBuilder.prepare();

        // later we can set the select argument and issue the query
        selectArg.setValue(pFirstname);
        List<Author> tgs = dbHelper.getAuthorDao().query(preparedQuery);
        if (!tgs.isEmpty()) {
            return tgs.get(0);
        }
    } catch (java.sql.SQLException pE) {
        pE.printStackTrace();
    }
    return null;
}
 
開發者ID:mrspaceman,項目名稱:ebookmgr,代碼行數:24,代碼來源:LibraryManager.java

示例5: getBranchBookings

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
 * Returns all the bookings for a given branch in the SQLite database
 *
 * @param currentBranch the specified branch
 * @return a list of the matching bookings
 */
@Override
public List<Booking> getBranchBookings(Branch currentBranch) {
    try {
        QueryBuilder<Booking, Integer> statementBuilder = dao.queryBuilder();
        Where whereClause = statementBuilder.where();

        whereClause.eq(Booking.BRANCH_FIELD_NAME, currentBranch);

        statementBuilder.orderBy(Booking.START_DAY_FIELD_NAME, true);

        return dao.query(statementBuilder.prepare());
    } catch (SQLException e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:AlexisChevalier,項目名稱:CarRental-Distributed-System,代碼行數:23,代碼來源:BookingDaoSqliteImpl.java

示例6: findProfileSwitchById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public ProfileSwitch findProfileSwitchById(String _id) {
    try {
        QueryBuilder<ProfileSwitch, Long> queryBuilder = getDaoProfileSwitch().queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        PreparedQuery<ProfileSwitch> preparedQuery = queryBuilder.prepare();
        List<ProfileSwitch> list = getDaoProfileSwitch().query(preparedQuery);

        if (list.size() == 1) {
            return list.get(0);
        } else {
            return null;
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:19,代碼來源:DatabaseHelper.java

示例7: queryForPagesByOrder

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
 * 分頁排序查詢
 *
 * @param columnName  查詢條件列名
 * @param value       查詢條件值
 * @param orderColumn 排序列名
 * @param ascending   true為升序,false為降序
 * @param offset      搜索下標
 * @param count       搜索條數
 * @return 分頁查詢後的數據集
 */
public List<T> queryForPagesByOrder(String columnName, Object value, String orderColumn, boolean ascending, Long offset, Long count) {
    List<T> list = null;
    QueryBuilder queryBuilder = ormLiteDao.queryBuilder();
    Where where = queryBuilder.where();
    try {
        where.eq(columnName, value);
        queryBuilder.orderBy(orderColumn, ascending);
        queryBuilder.offset(offset);
        queryBuilder.limit(count);
        list = queryBuilder.query();
    } catch (SQLException e) {
        LogUtils.e(e);
    }
    return list;
}
 
開發者ID:lujianzhao,項目名稱:AndroidBase,代碼行數:27,代碼來源:OrmLiteDao.java

示例8: findFoodById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public Food findFoodById(String _id) {
    try {
        QueryBuilder<Food, Long> queryBuilder = getDaoFood().queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        PreparedQuery<Food> preparedQuery = queryBuilder.prepare();
        List<Food> list = getDaoFood().query(preparedQuery);

        if (list.size() == 1) {
            return list.get(0);
        } else {
            return null;
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:19,代碼來源:FoodHelper.java

示例9: findTreatmentById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
@Nullable
public Treatment findTreatmentById(String _id) {
    try {
        Dao<Treatment, Long> daoTreatments = getDaoTreatments();
        QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        queryBuilder.limit(10L);
        PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
        List<Treatment> trList = daoTreatments.query(preparedQuery);
        if (trList.size() != 1) {
            //log.debug("Treatment findTreatmentById query size: " + trList.size());
            return null;
        } else {
            //log.debug("Treatment findTreatmentById found: " + trList.get(0).log());
            return trList.get(0);
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:23,代碼來源:DatabaseHelper.java

示例10: findTempTargetById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public TempTarget findTempTargetById(String _id) {
    try {
        QueryBuilder<TempTarget, Long> queryBuilder = getDaoTempTargets().queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        PreparedQuery<TempTarget> preparedQuery = queryBuilder.prepare();
        List<TempTarget> list = getDaoTempTargets().query(preparedQuery);

        if (list.size() == 1) {
            return list.get(0);
        } else {
            return null;
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:19,代碼來源:DatabaseHelper.java

示例11: getDanaRHistoryRecordsByType

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public List<DanaRHistoryRecord> getDanaRHistoryRecordsByType(byte type) {
    List<DanaRHistoryRecord> historyList;
    try {
        QueryBuilder<DanaRHistoryRecord, String> queryBuilder = getDaoDanaRHistory().queryBuilder();
        queryBuilder.orderBy("recordDate", false);
        Where where = queryBuilder.where();
        where.eq("recordCode", type);
        queryBuilder.limit(200L);
        PreparedQuery<DanaRHistoryRecord> preparedQuery = queryBuilder.prepare();
        historyList = getDaoDanaRHistory().query(preparedQuery);
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
        historyList = new ArrayList<>();
    }
    return historyList;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:17,代碼來源:DatabaseHelper.java

示例12: findTempBasalById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public TemporaryBasal findTempBasalById(String _id) {
    try {
        QueryBuilder<TemporaryBasal, Long> queryBuilder = null;
        queryBuilder = getDaoTemporaryBasal().queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        PreparedQuery<TemporaryBasal> preparedQuery = queryBuilder.prepare();
        List<TemporaryBasal> list = getDaoTemporaryBasal().query(preparedQuery);

        if (list.size() != 1) {
            return null;
        } else {
            return list.get(0);
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:20,代碼來源:DatabaseHelper.java

示例13: findExtendedBolusById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public ExtendedBolus findExtendedBolusById(String _id) {
    try {
        QueryBuilder<ExtendedBolus, Long> queryBuilder = null;
        queryBuilder = getDaoExtendedBolus().queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        PreparedQuery<ExtendedBolus> preparedQuery = queryBuilder.prepare();
        List<ExtendedBolus> list = getDaoExtendedBolus().query(preparedQuery);

        if (list.size() == 1) {
            return list.get(0);
        } else {
            return null;
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:20,代碼來源:DatabaseHelper.java

示例14: getLastCareportalEvent

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
@Nullable
public CareportalEvent getLastCareportalEvent(String event) {
    try {
        List<CareportalEvent> careportalEvents;
        QueryBuilder<CareportalEvent, Long> queryBuilder = getDaoCareportalEvents().queryBuilder();
        queryBuilder.orderBy("date", false);
        Where where = queryBuilder.where();
        where.eq("eventType", event);
        queryBuilder.limit(1L);
        PreparedQuery<CareportalEvent> preparedQuery = queryBuilder.prepare();
        careportalEvents = getDaoCareportalEvents().query(preparedQuery);
        if (careportalEvents.size() == 1)
            return careportalEvents.get(0);
        else
            return null;
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
    return null;
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:21,代碼來源:DatabaseHelper.java

示例15: deleteCareportalEventById

import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public void deleteCareportalEventById(String _id) {
    try {
        QueryBuilder<CareportalEvent, Long> queryBuilder = null;
        queryBuilder = getDaoCareportalEvents().queryBuilder();
        Where where = queryBuilder.where();
        where.eq("_id", _id);
        PreparedQuery<CareportalEvent> preparedQuery = queryBuilder.prepare();
        List<CareportalEvent> list = getDaoCareportalEvents().query(preparedQuery);

        if (list.size() == 1) {
            CareportalEvent record = list.get(0);
            if (Config.logIncommingData)
                log.debug("Removing CareportalEvent record from database: " + record.log());
            delete(record);
        } else {
            if (Config.logIncommingData)
                log.debug("CareportalEvent not found database: " + _id);
        }
    } catch (SQLException e) {
        log.error("Unhandled exception", e);
    }
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:23,代碼來源:DatabaseHelper.java


注:本文中的com.j256.ormlite.stmt.Where.eq方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。