use of io.github.ihongs.db.DB in project HongsCORE by ihongs.
the class DBDeff method syncSlaver.
/**
* 同步从数据库
* @param slaver
* @param tablePrefix 从库表前缀
* @param tableSuffix 从库表后缀
* @param delExtraTables 删除多余的表
* @param delExtraFields 删除多余的字段
* @throws io.github.ihongs.HongsException
*/
public void syncSlaver(DB slaver, String tablePrefix, String tableSuffix, boolean delExtraTables, boolean delExtraFields) throws HongsException {
List<String> sqls = this.deffSlaver(slaver, tablePrefix, tableSuffix, delExtraTables, delExtraFields);
DB sdb = slaver;
sdb.begin();
try {
for (String sql : sqls) {
sdb.execute(sql);
}
sdb.commit();
} catch (HongsException ex) {
sdb.revert();
throw ex;
}
}
use of io.github.ihongs.db.DB in project HongsCORE by ihongs.
the class TableDeff method syncSlaver.
/**
* 同步从表结构
* @param slaver
* @param delExtraFields 删除多余的字段
* @throws io.github.ihongs.HongsException
*/
public void syncSlaver(Table slaver, boolean delExtraFields) throws HongsException {
List<String> sqls = this.deffSlaver(slaver, delExtraFields);
DB sdb = slaver.db;
sdb.begin();
try {
for (String sql : sqls) {
sdb.execute(sql);
}
sdb.commit();
} catch (HongsException ex) {
sdb.revert();
throw ex;
}
}
Aggregations