예제 #1
0
 /** 创建表 */
 @Override
 public void onCreate(SQLiteDatabase db) {
   try {
     ArrayList<String> scripts = dbArchitecture.getGenTableScripts();
     if (scripts.size() > 0) {
       for (String sql : scripts) {
         db.execSQL(sql);
       }
     }
   } catch (Exception e) {
     if (YFLog.isDebug()) {
       YFLog.e("SQLiteHelper_onCreate", e.getMessage());
     } else {
       e.printStackTrace();
     }
   }
 }
예제 #2
0
 /** 更新表(升级版本) */
 @Override
 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
   try {
     ArrayList<String> scripts = dbArchitecture.getDBUpdateScripts(oldVersion, newVersion);
     if (scripts.size() > 0) {
       for (String sql : scripts) {
         db.execSQL(sql);
       }
     }
   } catch (Exception e) {
     if (YFLog.isDebug()) {
       YFLog.e("SQLiteHelper_onUpgrade", e.getMessage());
     } else {
       e.printStackTrace();
     }
   }
 }