Exemplo n.º 1
0
  public void dropDb() throws DbException {
    Cursor cursor =
        execQuery("SELECT name FROM sqlite_master WHERE type='table' AND name<>'sqlite_sequence'");
    if (cursor != null) {
      try {
        while (cursor.moveToNext()) {
          try {
            String tableName = cursor.getString(0);
            execNonQuery("DROP TABLE " + tableName);
            Table.remove(this, tableName);
          } catch (Throwable e) {
            LogUtils.e(e.getMessage(), e);
          }
        }

      } catch (Throwable e) {
        throw new DbException(e);
      } finally {
        IOUtils.closeQuietly(cursor);
      }
    }
  }
Exemplo n.º 2
0
 public void dropTable(Class<?> entityType) throws DbException {
   if (!tableIsExist(entityType)) return;
   String tableName = TableUtils.getTableName(entityType);
   execNonQuery("DROP TABLE " + tableName);
   Table.remove(this, entityType);
 }