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; }
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; }