Example #1
0
  public void attachSQLiteDatabase(String sqliteDBFile) throws DBException {

    SQLiteAccess query = new SQLiteAccess(sqliteDBFile);

    Collection<String> tableList = query.getTableList();
    List<String> infoTableList =
        CollectionUtil.select(
            tableList,
            new Predicate<String>() {
              public boolean apply(String input) {
                return isInfoTable(input);
              }
            });
    List<String> dataTableList =
        CollectionUtil.select(
            tableList,
            new Predicate<String>() {
              public boolean apply(String input) {
                return !isInfoTable(input);
              }
            });

    // HashMap<String, HashMap<String, String>>
    for (String infoTable : infoTableList) {
      for (DataModelInfo info : query.amoebaQuery(DataModelInfo.class, infoTable)) {}
    }

    for (String dataTable : dataTableList) {
      Relation relation = new Relation();
      for (SQLiteDataTypeInfo dataType : query.getSQLiteDataTypeInfo(dataTable)) {
        relation.add(Relation.getDataType(dataType.getName(), dataType.getType()));
      }
      addRelation(relation);
    }
  }