本文整理汇总了Java中com.raizlabs.android.dbflow.config.DatabaseDefinition类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseDefinition类的具体用法?Java DatabaseDefinition怎么用?Java DatabaseDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseDefinition类属于com.raizlabs.android.dbflow.config包,在下文中一共展示了DatabaseDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: save
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
/**
* 新增或者修改数据库的统一方法
* @param tClass 传递一个class信息
* @param models 这个class对应的实例的数组
* @param <Model> 这个实例的泛型 限定条件是BaseModel
*/
public static<Model extends BaseModel> void save(final Class<Model> tClass, final Model... models) {
if (models==null||models.length==0) return;
// 当前数据库的一个管理者
DatabaseDefinition definition = FlowManager.getDatabase(AppDatabase.class);
// 提交一个事务
definition.beginTransactionAsync(new ITransaction() {
@Override
public void execute(DatabaseWrapper databaseWrapper) {
// 执行
ModelAdapter<Model> adapter = FlowManager.getModelAdapter(tClass);
// 保存
adapter.saveAll(Arrays.asList(models));
// 唤起通知
instance.notifySave(tClass,models);
}
}).build().execute();
}
开发者ID:FZZFVII,项目名称:pipe,代码行数:24,代码来源:DbHelper.java
示例2: delete
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
/**
* 删除数据库的的统一方法
* @param tClass 传递一个class信息
* @param models 这个class对应的实例的数组
* @param <Model> 这个实例的泛型 限定条件是BaseModel
*/
public static<Model extends BaseModel> void delete(final Class<Model> tClass, final Model... models) {
if (models==null||models.length==0) return;
// 当前数据库的一个管理者
DatabaseDefinition definition = FlowManager.getDatabase(AppDatabase.class);
// 提交一个事务
definition.beginTransactionAsync(new ITransaction() {
@Override
public void execute(DatabaseWrapper databaseWrapper) {
// 执行
ModelAdapter<Model> adapter = FlowManager.getModelAdapter(tClass);
// 删除
adapter.deleteAll(Arrays.asList(models));
// 唤起通知
instance.notifyDelete(tClass,models);
}
}).build().execute();
}
开发者ID:FZZFVII,项目名称:pipe,代码行数:24,代码来源:DbHelper.java
示例3: updateGroup
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
/**
* 从成员中找出成员对应的群,并对群进行更新
*
* @param members 群成员列表
*/
private void updateGroup(GroupMember... members) {
// 不重复集合
final Set<String> groupIds = new HashSet<>();
for (GroupMember member : members) {
// 添加群Id
groupIds.add(member.getGroup().getId());
}
// 异步的数据库查询,并异步的发起二次通知
DatabaseDefinition definition = FlowManager.getDatabase(AppDatabase.class);
definition.beginTransactionAsync(new ITransaction() {
@Override
public void execute(DatabaseWrapper databaseWrapper) {
// 找到需要通知的群
List<Group> groups = SQLite.select()
.from(Group.class)
.where(Group_Table.id.in(groupIds))
.queryList();
// 调用直接进行一次通知分发
instance.notifySave(Group.class, groups.toArray(new Group[0]));
}
}).build().execute();
}
开发者ID:FZZFVII,项目名称:pipe,代码行数:31,代码来源:DbHelper.java
示例4: RetrievalAdapter
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public RetrievalAdapter(@NonNull DatabaseDefinition databaseDefinition) {
DatabaseConfig databaseConfig = FlowManager.getConfig()
.getConfigForDatabase(databaseDefinition.getAssociatedDatabaseClassFile());
if (databaseConfig != null) {
tableConfig = databaseConfig.getTableConfigForTable(getModelClass());
if (tableConfig != null) {
if (tableConfig.singleModelLoader() != null) {
singleModelLoader = tableConfig.singleModelLoader();
}
if (tableConfig.listModelLoader() != null) {
listModelLoader = tableConfig.listModelLoader();
}
}
}
}
开发者ID:Raizlabs,项目名称:DBFlow,代码行数:17,代码来源:RetrievalAdapter.java
示例5: upDataBySynchronous
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public static void upDataBySynchronous(final ArrayList<SOListBean.ListBean> mListBeans, final String type){
DatabaseDefinition database = FlowManager.getDatabase(LueansDB.class);
database.executeTransaction(new ITransaction() {
@Override
public void execute(DatabaseWrapper databaseWrapper) {
// do something here
deleteSoDdata(type);
saveSoData(mListBeans,type);
}
});
}
开发者ID:lueans,项目名称:LueansRead,代码行数:12,代码来源:SoDao.java
示例6: deleteSQLiteMetadata
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
/**
* This method removes the sqlite_sequence table that contains the last autoincrement value for
* each table
*/
private void deleteSQLiteMetadata() {
String sqlCopy = "Delete from sqlite_sequence";
DatabaseDefinition databaseDefinition =
FlowManager.getDatabase(AppDatabase.class);
databaseDefinition.getWritableDatabase().execSQL(sqlCopy);
}
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:12,代码来源:LocalPullController.java
示例7: saveAllItems
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
protected static void saveAllItems(final List<Model> models) {
DatabaseDefinition databaseDefinition =
FlowManager.getDatabase(AppDatabase.class); // execute transaction
databaseDefinition.executeTransaction(new ITransaction() {
@Override
public void execute(DatabaseWrapper databaseWrapper) {
for (Model model : models) {
model.insert();
}
}
});
}
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:13,代码来源:PopulateDB.java
示例8: saveBatch
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public static void saveBatch(final List<Model> insertModels) {
//Save questions in batch
DatabaseDefinition databaseDefinition =
FlowManager.getDatabase(AppDatabase.class);
databaseDefinition.executeTransaction(new ITransaction() {
@Override
public void execute(DatabaseWrapper databaseWrapper) {
for (Model model : insertModels) {
model.insert();
}
}
});
}
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:15,代码来源:SdkQueries.java
示例9: deleteSQLiteMetadata
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
/**
* This method removes the sqlite_sequence table that contains the last autoincrement value for
* each table
*/
private static void deleteSQLiteMetadata() {
String sqlCopy = "Delete from sqlite_sequence";
DatabaseDefinition databaseDefinition =
FlowManager.getDatabase(AppDatabase.class);
databaseDefinition.getWritableDatabase().execSQL(sqlCopy);
}
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:12,代码来源:PopulateDB.java
示例10: FlowSQLiteOpenHelper
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public FlowSQLiteOpenHelper(@NonNull DatabaseDefinition databaseDefinition,
@NonNull DatabaseHelperListener listener) {
super(FlowManager.getContext(), databaseDefinition.isInMemory() ? null : databaseDefinition.getDatabaseFileName(),
null, databaseDefinition.getDatabaseVersion());
OpenHelper backupHelper = null;
if (databaseDefinition.backupEnabled()) {
// Temp database mirrors existing
backupHelper = new BackupHelper(FlowManager.getContext(),
DatabaseHelperDelegate.getTempDbFileName(databaseDefinition),
databaseDefinition.getDatabaseVersion(), databaseDefinition);
}
databaseHelperDelegate = new DatabaseHelperDelegate(listener, databaseDefinition, backupHelper);
}
开发者ID:Raizlabs,项目名称:DBFlow,代码行数:16,代码来源:FlowSQLiteOpenHelper.java
示例11: ModelAdapter
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public ModelAdapter(@NonNull DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
if (getTableConfig() != null && getTableConfig().modelSaver() != null) {
modelSaver = getTableConfig().modelSaver();
modelSaver.setModelAdapter(this);
}
}
开发者ID:Raizlabs,项目名称:DBFlow,代码行数:8,代码来源:ModelAdapter.java
示例12: getDatabase
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
@NonNull
protected DatabaseDefinition getDatabase() {
if (database == null) {
database = FlowManager.getDatabase(getDatabaseName());
}
return database;
}
开发者ID:Raizlabs,项目名称:DBFlow,代码行数:8,代码来源:BaseContentProvider.java
示例13: getDatabaseDefinition
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
@NonNull
public DatabaseDefinition getDatabaseDefinition() {
if (databaseDefinition == null) {
databaseDefinition = FlowManager.getDatabaseForTable(modelClass);
}
return databaseDefinition;
}
开发者ID:Raizlabs,项目名称:DBFlow,代码行数:8,代码来源:ModelLoader.java
示例14: SQLCipherOpenHelper
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public SQLCipherOpenHelper(DatabaseDefinition databaseDefinition, DatabaseHelperListener listener) {
super(FlowManager.getContext(), databaseDefinition.isInMemory() ? null : databaseDefinition.getDatabaseFileName(), null, databaseDefinition.getDatabaseVersion());
SQLiteDatabase.loadLibs(FlowManager.getContext());
OpenHelper backupHelper = null;
if (databaseDefinition.backupEnabled()) {
// Temp database mirrors existing
backupHelper = new BackupHelper(FlowManager.getContext(), DatabaseHelperDelegate.getTempDbFileName(databaseDefinition),
databaseDefinition.getDatabaseVersion(), databaseDefinition);
}
databaseHelperDelegate = new DatabaseHelperDelegate(listener, databaseDefinition, backupHelper);
}
开发者ID:Raizlabs,项目名称:DBFlow,代码行数:14,代码来源:SQLCipherOpenHelper.java
示例15: WeatherData_Table
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public WeatherData_Table(DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
}
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:4,代码来源:WeatherData_Table.java
示例16: Weather_Table
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public Weather_Table(DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
}
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:4,代码来源:Weather_Table.java
示例17: Sys_Table
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public Sys_Table(DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
}
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:4,代码来源:Sys_Table.java
示例18: Main_Table
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public Main_Table(DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
}
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:4,代码来源:Main_Table.java
示例19: WeatherForecastData_Table
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public WeatherForecastData_Table(DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
}
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:4,代码来源:WeatherForecastData_Table.java
示例20: Rain_Table
import com.raizlabs.android.dbflow.config.DatabaseDefinition; //导入依赖的package包/类
public Rain_Table(DatabaseDefinition databaseDefinition) {
super(databaseDefinition);
}
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:4,代码来源:Rain_Table.java
注:本文中的com.raizlabs.android.dbflow.config.DatabaseDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论