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


Java SelectArg类代码示例

本文整理汇总了Java中com.j256.ormlite.stmt.SelectArg的典型用法代码示例。如果您正苦于以下问题:Java SelectArg类的具体用法?Java SelectArg怎么用?Java SelectArg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SelectArg类属于com.j256.ormlite.stmt包,在下文中一共展示了SelectArg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPantheon

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
public ArrayList<God> getPantheon(God g){
	ArrayList<God> fam = new ArrayList<God>();
	if (g.getPantheon() != null)
	{
		try {
			for (God cur : this.queryForEq("pantheon", new SelectArg(g.getPantheon()))){
				if (cur.getID() != g.getID()){
					fam.add(cur);
				}
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	return fam;
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:17,代码来源:GodDaoImpl.java

示例2: getFamily

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
public ArrayList<Npc> getFamily(Npc npc){
	ArrayList<Npc> fam = new ArrayList<Npc>();
	if (npc.getlName() != null)
	{
		try {
			for (Npc g : this.queryForEq("lName", new SelectArg(npc.getlName()))){
				if (g.getID() != npc.getID()){
					fam.add(g);
				}
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	return fam;
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:17,代码来源:NpcDaoImpl.java

示例3: getTag

import com.j256.ormlite.stmt.SelectArg; //导入依赖的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

示例4: getBook

import com.j256.ormlite.stmt.SelectArg; //导入依赖的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

示例5: lookupTagsForEBook

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
private List<Tag> lookupTagsForEBook(EBook ebk) throws SQLException {
    if (tagsForEBookQuery == null) {
        QueryBuilder<EBookTags, Long> dbQryBld = dbHelper.getEBookTagsDao().queryBuilder();

        // this time selecting for the user-id field
        dbQryBld.selectColumns(EBookTags.COLUMN_NAME_TAG_ID);
        SelectArg postSelectArg = new SelectArg();
        dbQryBld.where().eq(EBookTags.COLUMN_NAME_BOOK_ID, postSelectArg);

        // build our outer query
        QueryBuilder<Tag, Long> userQb = dbHelper.getTagDao().queryBuilder();
        // where the user-id matches the inner query's user-id field
        userQb.where().in(Tag.COLUMN_NAME_ID, dbQryBld);
        tagsForEBookQuery = userQb.prepare();
    }
    tagsForEBookQuery.setArgumentHolderValue(0, ebk);
    return dbHelper.getTagDao().query(tagsForEBookQuery);
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:19,代码来源:LibraryManager.java

示例6: getFileType

import com.j256.ormlite.stmt.SelectArg; //导入依赖的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

示例7: getAuthor

import com.j256.ormlite.stmt.SelectArg; //导入依赖的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

示例8: lookupEBooksForTag

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
private List<EBook> lookupEBooksForTag(Tag pTag) throws SQLException {
    if (ebooksForTagQuery == null) {
        // build our inner query for UserPost objects
        QueryBuilder<EBookTags, Long> dbQryBld = dbHelper.getEBookTagsDao().queryBuilder();

        // just select the post-id field
        dbQryBld.selectColumns(EBookTags.COLUMN_NAME_BOOK_ID);
        SelectArg userSelectArg = new SelectArg();

        dbQryBld.where().eq(EBookTags.COLUMN_NAME_TAG_ID, userSelectArg);

        // build our outer query for Post objects
        QueryBuilder<EBook, Long> postQb = dbHelper.getEBookDao().queryBuilder()
                .orderByRaw("book_title COLLATE NOCASE");
        // where the id matches in the post-id from the inner query
        postQb.where().in(EBook.COLUMN_NAME_ID, dbQryBld);
        ebooksForTagQuery = postQb.prepare();
    }
    if (pTag != null) {
        ebooksForTagQuery.setArgumentHolderValue(0, pTag);
        return dbHelper.getEBookDao().query(ebooksForTagQuery);
    }
    return new ArrayList<>();
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:25,代码来源:LibraryManager.java

示例9: searchBooksMatching

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
public List<EBook> searchBooksMatching(final String searchStr) {
    List<EBook> result = new ArrayList<>();
    try {
        QueryBuilder<EBook, Long> queryBuilder = dbHelper.getEBookDao().queryBuilder();
        Where<EBook, Long> where = queryBuilder.where();
        SelectArg selectArg2 = new SelectArg();
        selectArg2.setValue("%" + searchStr + "%");
        SelectArg selectArg1 = new SelectArg();
        selectArg1.setValue("%" + searchStr + "%");

        // define our query as 'name = ?'
        where.like(EBook.COLUMN_FULL_FILE_NAME, selectArg1).or()
                .like(EBook.COLUMN_BOOK_TITLE, selectArg2);

        // 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
        result = dbHelper.getEBookDao().query(preparedQuery);
    } catch (SQLException pE) {
        pE.printStackTrace();
    }

    return result;
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:26,代码来源:LibraryManager.java

示例10: lookupEBooksForFileType

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
private List<EBook> lookupEBooksForFileType(FileType pTag) throws SQLException {
    if (ebooksForFiletypeQuery == null) {
        // build our inner query for UserPost objects
        QueryBuilder<EBookFileTypes, Long> dbQryBld = dbHelper.getEBookFileTypesDao().queryBuilder();

        // just select the post-id field
        dbQryBld.selectColumns(EBookFileTypes.COLUMN_NAME_BOOK_ID);
        SelectArg userSelectArg = new SelectArg();

        dbQryBld.where().eq(EBookFileTypes.COLUMN_NAME_TYPE_ID, userSelectArg);

        // build our outer query for Post objects
        QueryBuilder<EBook, Long> postQb = dbHelper.getEBookDao().queryBuilder();
        // where the id matches in the post-id from the inner query
        postQb.where().in(EBook.COLUMN_NAME_ID, dbQryBld);
        ebooksForFiletypeQuery = postQb.prepare();
    }
    if (pTag != null) {
        ebooksForFiletypeQuery.setArgumentHolderValue(0, pTag);
        return dbHelper.getEBookDao().query(ebooksForFiletypeQuery);
    }
    return new ArrayList<>();
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:24,代码来源:LibraryManager.java

示例11: lookupFileTypesForEBook

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
private List<FileType> lookupFileTypesForEBook(EBook ebk) throws SQLException {
    if (filetypeForEBookQuery == null) {
        QueryBuilder<EBookFileTypes, Long> dbQryBld = dbHelper.getEBookFileTypesDao().queryBuilder();

        // this time selecting for the user-id field
        dbQryBld.selectColumns(EBookFileTypes.COLUMN_NAME_TYPE_ID);
        SelectArg postSelectArg = new SelectArg();
        dbQryBld.where().eq(EBookFileTypes.COLUMN_NAME_BOOK_ID, postSelectArg);

        // build our outer query
        QueryBuilder<FileType, Long> userQb = dbHelper.getFileTypeDao().queryBuilder();
        // where the user-id matches the inner query's user-id field
        userQb.where().in(FileType.COLUMN_NAME_ID, dbQryBld);
        filetypeForEBookQuery = userQb.prepare();
    }
    filetypeForEBookQuery.setArgumentHolderValue(0, ebk);
    return dbHelper.getFileTypeDao().query(filetypeForEBookQuery);
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:19,代码来源:LibraryManager.java

示例12: lookupEBooksForAuthor

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
private List<EBook> lookupEBooksForAuthor(Author pTag) throws SQLException {
    if (ebooksForFiletypeQuery == null) {
        // build our inner query for UserPost objects
        QueryBuilder<EBookAuthors, Long> dbQryBld = dbHelper.getEBookAuthorsDao().queryBuilder();

        // just select the post-id field
        dbQryBld.selectColumns(EBookAuthors.COLUMN_NAME_BOOK_ID);
        SelectArg userSelectArg = new SelectArg();

        dbQryBld.where().eq(EBookAuthors.COLUMN_NAME_AUTHOR_ID, userSelectArg);

        // build our outer query for Post objects
        QueryBuilder<EBook, Long> postQb = dbHelper.getEBookDao().queryBuilder();
        // where the id matches in the post-id from the inner query
        postQb.where().in(EBook.COLUMN_NAME_ID, dbQryBld);
        ebooksForFiletypeQuery = postQb.prepare();
    }
    if (pTag != null) {
        ebooksForFiletypeQuery.setArgumentHolderValue(0, pTag);
        return dbHelper.getEBookDao().query(ebooksForFiletypeQuery);
    }
    return new ArrayList<>();
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:24,代码来源:LibraryManager.java

示例13: lookupAuthorsForEBook

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
private List<Author> lookupAuthorsForEBook(EBook ebk) throws SQLException {
    if (authorForEBookQuery == null) {
        QueryBuilder<EBookAuthors, Long> dbQryBld = dbHelper.getEBookAuthorsDao().queryBuilder();

        // this time selecting for the user-id field
        dbQryBld.selectColumns(EBookAuthors.COLUMN_NAME_AUTHOR_ID);
        SelectArg postSelectArg = new SelectArg();
        dbQryBld.where().eq(EBookAuthors.COLUMN_NAME_BOOK_ID, postSelectArg);

        // build our outer query
        QueryBuilder<Author, Long> userQb = dbHelper.getAuthorDao().queryBuilder();
        // where the user-id matches the inner query's user-id field
        userQb.where().in(Author.COLUMN_NAME_ID, dbQryBld);
        authorForEBookQuery = userQb.prepare();
    }
    authorForEBookQuery.setArgumentHolderValue(0, ebk);
    return dbHelper.getAuthorDao().query(authorForEBookQuery);
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:19,代码来源:LibraryManager.java

示例14: bucketOps

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
public static void bucketOps(String path, Boolean bucket, Context mContext) {
    final OrmHandler ormHandler = OpenHelperManager.getHelper(mContext, OrmHandler.class);
    try {
        Dao<Track, String> dbTrack = ormHandler.getDao(Track.class);
        QueryBuilder<Track, String> queryBuilder = dbTrack.queryBuilder();
        SelectArg selectArg = new SelectArg();
        queryBuilder.where().eq("path", selectArg);
        PreparedQuery<Track> preparedQuery = queryBuilder.prepare();
        selectArg.setValue(path);
        List<Track> lister = dbTrack.query(preparedQuery);
        Track temp_track = lister.get(0);
        temp_track.setBucket(bucket);
        dbTrack.update(temp_track);
        BUCKET_OPS = true;
    } catch (SQLException | IndexOutOfBoundsException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Circle-Of-Music-Makers,项目名称:com-android,代码行数:19,代码来源:Utils.java

示例15: getByName

import com.j256.ormlite.stmt.SelectArg; //导入依赖的package包/类
public static Stream getByName(ZulipApp app, String name) {
    Stream stream = null;
    try {
        RuntimeExceptionDao<Stream, Object> streams = app.getDao(Stream.class);
        stream = streams.queryBuilder().where()
                .eq(Stream.NAME_FIELD, new SelectArg(name)).queryForFirst();

        if (stream == null) {
            Log.w("Stream.getByName",
                    "We received a stream message for a stream we don't have data for. Fake it until you make it.");
            stream = new Stream(name);
            app.getDao(Stream.class).createIfNotExists(stream);
        }
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

    return stream;
}
 
开发者ID:zulip,项目名称:zulip-android,代码行数:20,代码来源:Stream.java


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