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


Java Select类代码示例

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


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

示例1: testAddressItems

import ollie.query.Select; //导入依赖的package包/类
public static void testAddressItems(Context context) {
	Delete.from(SimpleAddressItem.class).execute();

	final Collection<SimpleAddressItem> ollieModels =
			Generator.getAddresses(SimpleAddressItem.class, MainActivity.LOOP_COUNT);

	long startTime = System.currentTimeMillis();
	// Reuse method so we don't have to write
	TransactionManager.transact(Ollie.getDatabase(), new Runnable() {
		@Override
		public void run() {
			Saver.saveAll(ollieModels);
		}
	});
	EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.SAVE_TIME));

	startTime = System.currentTimeMillis();
	Collection<SimpleAddressItem> activeAndroidModelLoad =
			Select.from(SimpleAddressItem.class).fetch();
	EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.LOAD_TIME));

	Delete.from(SimpleAddressItem.class).execute();
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:24,代码来源:OllieTester.java

示例2: getTagsNamesPerIds

import ollie.query.Select; //导入依赖的package包/类
private List<String> getTagsNamesPerIds(@NonNull List<String> tagsIds) {
    boolean addSeparator = false;
    List<String> args = new ArrayList<>();

    StringBuilder whereStr = new StringBuilder("_id IN (");
    for (String tagId : tagsIds) {
        if (addSeparator) {
            whereStr.append(",");
        } else {
            addSeparator = true;
        }

        whereStr.append("?");
        args.add(tagId);
    }
    whereStr.append(")");

    List<Tag> tags = Select.from(Tag.class).where(whereStr.toString(), args.toArray(new String[args.size()])).fetch();
    List<String> tagsNames = new ArrayList<>(tags.size());
    for (Tag tag : tags) {
        tagsNames.add(tag.name);
    }
    return tagsNames;
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:25,代码来源:BaggersDao.java

示例3: getAddresses

import ollie.query.Select; //导入依赖的package包/类
@Override
public Collection<AddressItem> getAddresses() {
    if (addresses == null) {
        addresses = Select.from(AddressItem.class).where("addressBook = ?", id).fetch();
    }
    return addresses;
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:8,代码来源:AddressBook.java

示例4: getContacts

import ollie.query.Select; //导入依赖的package包/类
@Override
public Collection<Contact> getContacts() {
    if (contacts == null) {
        contacts = Select.from(Contact.class).where("addressBook = ?", id).fetch();
    }
    return contacts;
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:8,代码来源:AddressBook.java

示例5: testAddressBooks

import ollie.query.Select; //导入依赖的package包/类
public static void testAddressBooks(Context context) {
	Delete.from(AddressItem.class).execute();
	Delete.from(Contact.class).execute();
	Delete.from(AddressBook.class).execute();

	Collection<AddressBook> addressBooks = Generator.createAddressBooks(AddressBook.class, Contact.class, AddressItem.class, MainActivity.ADDRESS_BOOK_COUNT);

	long startTime = System.currentTimeMillis();
	final Collection<AddressBook> finalAddressBooks = addressBooks;
	TransactionManager.transact(Ollie.getDatabase(), new Runnable()
	{
		@Override
		public void run()
		{
			Saver.saveAll(finalAddressBooks);
		}
	});
	EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.SAVE_TIME));

	startTime = System.currentTimeMillis();
	addressBooks = Select.from(AddressBook.class).fetch();
	Loader.loadAllInnerData(addressBooks);
	EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.LOAD_TIME));

	Delete.from(AddressItem.class).execute();
	Delete.from(Contact.class).execute();
	Delete.from(AddressBook.class).execute();
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:29,代码来源:OllieTester.java

示例6: getLocations

import ollie.query.Select; //导入依赖的package包/类
public List<Location> getLocations() {
    List<Location> locations = Select.from(Location.class).fetch();
    for (Location location : locations) {
        fillLocationData(location);
    }
    return locations;
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:8,代码来源:LocationsDao.java

示例7: fillBaggerData

import ollie.query.Select; //导入依赖的package包/类
private void fillBaggerData(@NonNull Bagger bagger, @NonNull List<String> tagsIds) {
    // contacts
    bagger.contacts = Select.from(Contact.class).where("contacts.bagger_id=?", bagger.id).fetchSingle();
    if (bagger.contacts == null) {
        bagger.contacts = new Contact();
    }

    // cities
    List<City> cities = Select.from(City.class).innerJoin(BaggerCity.class).on("cities._id=baggers_cities.city_id").where("baggers_cities.bagger_id=?", bagger.id).fetch();
    bagger.cities = new ArrayList<>();
    for (City city : cities) {
        bagger.cities.add(city.name);
    }

    // sessions
    List<Session> sessions = Select.from(Session.class).where("bagger_id=?", bagger.id).fetch();
    for (Session session : sessions) {
        List<Tag> tags = Select.from(Tag.class).innerJoin(SessionTag.class).on("tags._id=sessions_tags.tag_id").where("sessions_tags.session_id=?", session.id).fetch();
        session.tags = new ArrayList<>();
        for (Tag tag : tags) {
            session.tags.add(tag.name);
        }
    }
    bagger.sessions = filterSessionsMatchingTags(sessions, tagsIds);

    // websites
    bagger.websites = Select.from(Website.class).where("bagger_id=?", bagger.id).fetch();
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:29,代码来源:BaggersDao.java

示例8: loadVideos

import ollie.query.Select; //导入依赖的package包/类
@Override
public void loadVideos() {

    // Load the videos from the database
    Select.from(Video.class)
            .observable()
            .subscribe(new Action1<List<Video>>() {
                @Override
                public void call(List<Video> videos) {
                    mView.setVideos(videos);
                }
            });


}
 
开发者ID:52inc,项目名称:android-Showcase,代码行数:16,代码来源:HomePresenterImpl.java

示例9: findAll

import ollie.query.Select; //导入依赖的package包/类
public static List<Article> findAll() {
    return Select.from(Article.class).fetch();
}
 
开发者ID:gotokatsuya,项目名称:Easy,代码行数:4,代码来源:ArticleRepository.java

示例10: hasData

import ollie.query.Select; //导入依赖的package包/类
public boolean hasData() {
    return Select.from(Location.class).fetchSingle() != null;
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:4,代码来源:LocationsDao.java

示例11: fillLocationData

import ollie.query.Select; //导入依赖的package包/类
private void fillLocationData(@NonNull Location location) {
    location.audience = Select.from(Audience.class).where("audiences.location_id=?", location.id).fetchSingle();
    location.interests = Select.from(Interest.class).innerJoin(LocationInterest.class).on("interests._id=locations_interests.interest_id").where("locations_interests.location_id=?", location.id).fetch();
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:5,代码来源:LocationsDao.java

示例12: hasData

import ollie.query.Select; //导入依赖的package包/类
public boolean hasData() {
    return Select.from(City.class).fetchSingle() != null;
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:4,代码来源:CitiesDao.java

示例13: getCities

import ollie.query.Select; //导入依赖的package包/类
public List<City> getCities() {
    return Select.from(City.class).orderBy("name ASC").fetch();
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:4,代码来源:CitiesDao.java

示例14: getCityByLatLng

import ollie.query.Select; //导入依赖的package包/类
public City getCityByLatLng(String lat, String lng) {
    return Select.from(City.class).where("lat=? AND lng=?", lat, lng).fetchSingle();
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:4,代码来源:CitiesDao.java

示例15: hasData

import ollie.query.Select; //导入依赖的package包/类
public boolean hasData() {
    return Select.from(Bagger.class).fetchSingle() != null;
}
 
开发者ID:Nilhcem,项目名称:bblfr-android,代码行数:4,代码来源:BaggersDao.java


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