use of com.abubusoft.kripton.android.sqlite.SQLiteUpdateTask in project kripton by xcesco.
the class BindSchoolDataSource method onUpgrade.
/**
* onUpgrade
*/
@Override
public void onUpgrade(SQLiteDatabase database, int previousVersion, int currentVersion) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Update database '%s' from version %s to version %s", this.name, previousVersion, currentVersion);
}
// if we have a list of update task, try to execute them
if (options.updateTasks != null) {
List<SQLiteUpdateTask> tasks = buildTaskList(previousVersion, currentVersion);
for (SQLiteUpdateTask task : tasks) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Begin update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
task.execute(database, previousVersion, previousVersion + 1);
// log section BEGIN
if (this.logEnabled) {
Logger.info("End update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
previousVersion++;
}
} else {
// drop all tables
SQLiteUpdateTaskHelper.dropTablesAndIndices(database);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", SeminarTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(SeminarTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", StudentTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(StudentTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", Seminar2StudentTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(Seminar2StudentTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", ProfessorTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(ProfessorTable.CREATE_TABLE_SQL);
}
if (options.databaseLifecycleHandler != null) {
options.databaseLifecycleHandler.onUpdate(database, previousVersion, currentVersion, true);
}
}
use of com.abubusoft.kripton.android.sqlite.SQLiteUpdateTask in project kripton by xcesco.
the class BindXenoDataSource method onUpgrade.
/**
* onUpgrade
*/
@Override
public void onUpgrade(SQLiteDatabase database, int previousVersion, int currentVersion) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Update database '%s' from version %s to version %s", this.name, previousVersion, currentVersion);
}
// if we have a list of update task, try to execute them
if (options.updateTasks != null) {
List<SQLiteUpdateTask> tasks = buildTaskList(previousVersion, currentVersion);
for (SQLiteUpdateTask task : tasks) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Begin update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
task.execute(database, previousVersion, previousVersion + 1);
// log section BEGIN
if (this.logEnabled) {
Logger.info("End update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
previousVersion++;
}
} else {
// drop all tables
SQLiteUpdateTaskHelper.dropTablesAndIndices(database);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PrefixConfigTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PrefixConfigTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PhoneNumberTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PhoneNumberTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PersonTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PersonTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", CountryTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(CountryTable.CREATE_TABLE_SQL);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PersonPhoneNumberTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PersonPhoneNumberTable.CREATE_TABLE_SQL);
}
if (options.databaseLifecycleHandler != null) {
options.databaseLifecycleHandler.onUpdate(database, previousVersion, currentVersion, true);
}
}
use of com.abubusoft.kripton.android.sqlite.SQLiteUpdateTask in project kripton by xcesco.
the class BindPersonUpdateDataSource method onUpgrade.
/**
* onUpgrade
*/
@Override
public void onUpgrade(SQLiteDatabase database, int previousVersion, int currentVersion) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Update database '%s' from version %s to version %s", this.name, previousVersion, currentVersion);
}
// if we have a list of update task, try to execute them
if (options.updateTasks != null) {
List<SQLiteUpdateTask> tasks = buildTaskList(previousVersion, currentVersion);
for (SQLiteUpdateTask task : tasks) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Begin update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
task.execute(database, previousVersion, previousVersion + 1);
// log section BEGIN
if (this.logEnabled) {
Logger.info("End update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
previousVersion++;
}
} else {
// drop all tables
SQLiteUpdateTaskHelper.dropTablesAndIndices(database);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PersonTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PersonTable.CREATE_TABLE_SQL);
}
if (options.databaseLifecycleHandler != null) {
options.databaseLifecycleHandler.onUpdate(database, previousVersion, currentVersion, true);
}
}
use of com.abubusoft.kripton.android.sqlite.SQLiteUpdateTask in project kripton by xcesco.
the class BindAppWithConfigDataSource method onUpgrade.
/**
* onUpgrade
*/
@Override
public void onUpgrade(SQLiteDatabase database, int previousVersion, int currentVersion) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Update database '%s' from version %s to version %s", this.name, previousVersion, currentVersion);
}
// if we have a list of update task, try to execute them
if (options.updateTasks != null) {
List<SQLiteUpdateTask> tasks = buildTaskList(previousVersion, currentVersion);
for (SQLiteUpdateTask task : tasks) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Begin update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
task.execute(database, previousVersion, previousVersion + 1);
// log section BEGIN
if (this.logEnabled) {
Logger.info("End update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
previousVersion++;
}
} else {
// drop all tables
SQLiteUpdateTaskHelper.dropTablesAndIndices(database);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PersonTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PersonTable.CREATE_TABLE_SQL);
}
if (options.databaseLifecycleHandler != null) {
options.databaseLifecycleHandler.onUpdate(database, previousVersion, currentVersion, true);
}
}
use of com.abubusoft.kripton.android.sqlite.SQLiteUpdateTask in project kripton by xcesco.
the class BindPerson1DataSource method onUpgrade.
/**
* onUpgrade
*/
@Override
public void onUpgrade(SQLiteDatabase database, int previousVersion, int currentVersion) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Update database '%s' from version %s to version %s", this.name, previousVersion, currentVersion);
}
// if we have a list of update task, try to execute them
if (options.updateTasks != null) {
List<SQLiteUpdateTask> tasks = buildTaskList(previousVersion, currentVersion);
for (SQLiteUpdateTask task : tasks) {
// log section BEGIN
if (this.logEnabled) {
Logger.info("Begin update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
task.execute(database, previousVersion, previousVersion + 1);
// log section BEGIN
if (this.logEnabled) {
Logger.info("End update database from version %s to %s", previousVersion, previousVersion + 1);
}
// log section END
previousVersion++;
}
} else {
// drop all tables
SQLiteUpdateTaskHelper.dropTablesAndIndices(database);
// log section BEGIN
if (this.logEnabled) {
Logger.info("DDL: %s", PersonTable.CREATE_TABLE_SQL);
}
// log section END
database.execSQL(PersonTable.CREATE_TABLE_SQL);
}
if (options.databaseLifecycleHandler != null) {
options.databaseLifecycleHandler.onUpdate(database, previousVersion, currentVersion, true);
}
}
Aggregations