Пример #1
0
    public StoreObject merge() {
      boolean alreadySetDatabaseObject = false;

      // first pass
      for (StoreObject store : this.storeObjects) {
        copySchemaInfo(store);
      }

      // second pass
      for (StoreObject store : this.storeObjects) {
        if (store.getSchema().getVersion() == targetStore.getSchema().getVersion()
            && !alreadySetDatabaseObject) {
          BaseSchema targetSchema = targetStore.getSchema();
          targetSchema.clearObjects();
          targetSchema.addObjects(mergeDatabaseObjects(store.getSchema().getObjects()));

          alreadySetDatabaseObject = true;
        }

        mergePatches(store.getPatches());
        mergeExistQueries(store.getExistQueries());
        mergeDropStatements(store.getDropStatements());
      }

      return this.targetStore;
    }
Пример #2
0
  protected PreparedStatement getExistQuery(Connection conn, DatabaseObjectType type)
      throws SQLException {
    PreparedStatement pstmt = null;

    for (SQLObject existQuery : catalogStore.getExistQueries()) {
      if (type.equals(existQuery.getType())) {
        pstmt = conn.prepareStatement(existQuery.getSql());
        break;
      }
    }

    return pstmt;
  }