本文整理汇总了Java中org.xutils.DbManager类的典型用法代码示例。如果您正苦于以下问题:Java DbManager类的具体用法?Java DbManager怎么用?Java DbManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbManager类属于org.xutils包,在下文中一共展示了DbManager类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: DownloadManager
import org.xutils.DbManager; //导入依赖的package包/类
private DownloadManager() {
DbManager.DaoConfig daoConfig = new DbManager.DaoConfig()
.setDbName("download")
.setDbVersion(1);
db = x.getDb(daoConfig);
try {
List<DownloadInfo> infoList = db.selector(DownloadInfo.class).findAll();
if (infoList != null) {
for (DownloadInfo info : infoList) {
if (info.getState().value() < DownloadState.FINISHED.value()) {
info.setState(DownloadState.STOPPED);
}
downloadInfoList.add(info);
}
}
} catch (DbException ex) {
LogUtil.e(ex.getMessage(), ex);
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:DownloadManager.java
示例2: TableEntity
import org.xutils.DbManager; //导入依赖的package包/类
TableEntity(DbManager db, Class<T> entityType) throws Throwable {
this.db = db;
this.entityType = entityType;
this.constructor = entityType.getConstructor();
this.constructor.setAccessible(true);
Table table = entityType.getAnnotation(Table.class);
this.name = table.name();
this.onCreated = table.onCreated();
this.columnMap = TableUtils.findColumnMap(entityType);
for (ColumnEntity column : columnMap.values()) {
if (column.isId()) {
this.id = column;
break;
}
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:TableEntity.java
示例3: onUpgrade
import org.xutils.DbManager; //导入依赖的package包/类
@Override
public void onUpgrade(DbManager db, int oldVersion, int newVersion) {
// TODO: ...
// db.addColumn(...);
// db.dropTable(...);
// ...
// or
// db.dropDb();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DbFragment.java
示例4: getInstance
import org.xutils.DbManager; //导入依赖的package包/类
public synchronized static DbManager getInstance(DaoConfig daoConfig) {
if (daoConfig == null) {//使用默认配置
daoConfig = new DaoConfig();
}
DbManagerImpl dao = DAO_MAP.get(daoConfig);
if (dao == null) {
dao = new DbManagerImpl(daoConfig);
DAO_MAP.put(daoConfig, dao);
} else {
dao.daoConfig = daoConfig;
}
// update the database if needed
SQLiteDatabase database = dao.database;
int oldVersion = database.getVersion();
int newVersion = daoConfig.getDbVersion();
if (oldVersion != newVersion) {
if (oldVersion != 0) {
DbUpgradeListener upgradeListener = daoConfig.getDbUpgradeListener();
if (upgradeListener != null) {
upgradeListener.onUpgrade(dao, oldVersion, newVersion);
} else {
try {
dao.dropDb();
} catch (DbException e) {
LogUtil.e(e.getMessage(), e);
}
}
}
database.setVersion(newVersion);
}
return dao;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:DbManagerImpl.java
示例5: getDaoConfig
import org.xutils.DbManager; //导入依赖的package包/类
public DbManager.DaoConfig getDaoConfig() {
//初始化数据库o
DbManager.DaoConfig daoConfig = new DbManager.DaoConfig()
.setDbName("comic_db")
.setDbVersion(1)
.setDbOpenListener(db -> {
// 开启WAL, 对写入加速提升巨大
db.getDatabase().enableWriteAheadLogging();
})
.setDbUpgradeListener((db, oldVersion, newVersion) -> db.getDatabase().enableWriteAheadLogging());
return daoConfig;
}
开发者ID:huxizhijian,项目名称:HHComicViewer,代码行数:13,代码来源:HHApplication.java
示例6: getChildren
import org.xutils.DbManager; //导入依赖的package包/类
public List<Child> getChildren(DbManager db) throws DbException {
return db.selector(Child.class).where("parentId", "=", this.id).findAll();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Parent.java
示例7: getParent
import org.xutils.DbManager; //导入依赖的package包/类
public Parent getParent(DbManager db) throws DbException {
return db.findById(Parent.class, parentId);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Child.java
示例8: onDbOpened
import org.xutils.DbManager; //导入依赖的package包/类
@Override
public void onDbOpened(DbManager db) {
// 开启WAL, 对写入加速提升巨大
db.getDatabase().enableWriteAheadLogging();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DbFragment.java
示例9: getDb
import org.xutils.DbManager; //导入依赖的package包/类
public DbManager getDb() {
return db;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:TableEntity.java
示例10: onDbOpened
import org.xutils.DbManager; //导入依赖的package包/类
@Override
public void onDbOpened(DbManager db) {
db.getDatabase().enableWriteAheadLogging();
}
开发者ID:ting4937,项目名称:AndroidUtils,代码行数:5,代码来源:DbUtils.java
示例11: getInstance
import org.xutils.DbManager; //导入依赖的package包/类
public static DbManager getInstance() {
return x.getDb(daoConfig);
}
开发者ID:ting4937,项目名称:AndroidUtils,代码行数:4,代码来源:DbUtils.java
示例12: PhotoManager
import org.xutils.DbManager; //导入依赖的package包/类
private PhotoManager () {
mConfig = new DbManager.DaoConfig();
mDb = x.getDb(mConfig);
}
开发者ID:boybeak,项目名称:DelegateAdapter,代码行数:5,代码来源:PhotoManager.java
示例13: onUpgrade
import org.xutils.DbManager; //导入依赖的package包/类
@Override
public void onUpgrade(DbManager db, int oldVersion, int newVersion) {
}
开发者ID:ting4937,项目名称:AndroidUtils,代码行数:5,代码来源:DbUtils.java
注:本文中的org.xutils.DbManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论