Some small fixes
Former-commit-id: 2b6db2d58ec76bba2d3e67ac66ce510d3920aba3
This commit is contained in:
parent
4ff6ae2b4c
commit
c04ca7a926
1 changed files with 9 additions and 8 deletions
|
|
@ -51,15 +51,16 @@ public class HalContext {
|
||||||
db = new DBConnection(DBConnection.DBMS.SQLite, DB_FILE);
|
db = new DBConnection(DBConnection.DBMS.SQLite, DB_FILE);
|
||||||
|
|
||||||
// Read DB conf
|
// Read DB conf
|
||||||
dbConf = new Properties();
|
dbConf =
|
||||||
db.exec("SELECT * FROM conf", new PropertiesSQLHandler(dbConf));
|
db.exec("SELECT * FROM conf", new PropertiesSQLHandler());
|
||||||
|
|
||||||
// Upgrade DB needed?
|
// Upgrade DB needed?
|
||||||
DBConnection defaultDB = new DBConnection(DBConnection.DBMS.SQLite, DEFAULT_DB_FILE);
|
DBConnection defaultDB = new DBConnection(DBConnection.DBMS.SQLite, DEFAULT_DB_FILE);
|
||||||
Properties defaultDBConf =
|
Properties defaultDBConf =
|
||||||
db.exec("SELECT * FROM conf", new PropertiesSQLHandler(new Properties()));
|
db.exec("SELECT * FROM conf", new PropertiesSQLHandler());
|
||||||
if(defaultDBConf.getProperty("db_version").compareTo(dbConf.getProperty("db_version")) > 0) {
|
if(defaultDBConf.getProperty("db_version") != null &&
|
||||||
logger.info("Upgrading DB (from: v"+dbConf.getProperty("db_version") +", to: v"+defaultDBConf.getProperty("db_version"));
|
defaultDBConf.getProperty("db_version").compareTo(dbConf.getProperty("db_version")) > 0) {
|
||||||
|
logger.info("Upgrading DB (from: v"+dbConf.getProperty("db_version") +", to: v"+defaultDBConf.getProperty("db_version") +")...");
|
||||||
upgradeDB();
|
upgradeDB();
|
||||||
}
|
}
|
||||||
defaultDB.close();
|
defaultDB.close();
|
||||||
|
|
@ -71,8 +72,8 @@ public class HalContext {
|
||||||
|
|
||||||
public static String getStringProperty(String key){
|
public static String getStringProperty(String key){
|
||||||
String value = fileConf.getProperty(key);
|
String value = fileConf.getProperty(key);
|
||||||
//if(value == null) // TODO: DB property
|
if(value == null)
|
||||||
// value = dbConf.getProperty(key);
|
value = dbConf.getProperty(key);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
public static int getIntegerProperty(String key){
|
public static int getIntegerProperty(String key){
|
||||||
|
|
@ -107,7 +108,7 @@ public class HalContext {
|
||||||
- remove backup table (DROP table 'temp_" + TableName)
|
- remove backup table (DROP table 'temp_" + TableName)
|
||||||
- setTransactionSuccessful
|
- setTransactionSuccessful
|
||||||
*/
|
*/
|
||||||
logger.severe("DB Upgrade not implemented yes!");
|
logger.severe("DB Upgrade not implemented yet!");
|
||||||
//db.exec("BeginTransaction");
|
//db.exec("BeginTransaction");
|
||||||
|
|
||||||
//db.exec("EndTransaction");
|
//db.exec("EndTransaction");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue