/** * @since 9.2 */ @Override default <P, V> ImmutableSet<V> flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter) { return this.flatCollect(each -> function.apply(each, parameter)); }
/** * @since 9.2 */ @Override default <P, V> ImmutableSet<V> flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter) { return this.flatCollect(each -> function.apply(each, parameter)); }
private ImmutableSet<DaTable> getExistingTablesInEnvironment(DbEnvironment env) { return env.getPhysicalSchemas().flatCollect(new Function<PhysicalSchema, Iterable<DaTable>>() { @Override public Iterable<DaTable> valueOf(PhysicalSchema physicalSchema) { DaCatalog database = dbMetadataManager.getDatabase(physicalSchema, new DaSchemaInfoLevel().setRetrieveTables(true), true, false); return database.getTables().reject(DaTable.IS_VIEW); } }); }
private ImmutableSet<DaTable> getExistingTablesInEnvironment(DbEnvironment env) { return env.getPhysicalSchemas().flatCollect(new Function<PhysicalSchema, Iterable<DaTable>>() { @Override public Iterable<DaTable> valueOf(PhysicalSchema physicalSchema) { DaCatalog database = dbMetadataManager.getDatabase(physicalSchema, new DaSchemaInfoLevel().setRetrieveTables(true), true, false); return database.getTables().reject(DaTable.IS_VIEW); } }); }
ImmutableSet<SchemaObjectRow> getTablesNeedingReorg(final Connection conn, final DbEnvironment env) { // keeping as system.out for now to facilitate output to maven output LOG.info("Starting DB2 post-deploy action: Querying for tables in reorg-ending state (this may take a minute)"); // trim the schema as DB2 seems to sometimes return the schema w/ spaces (even though where clauses can still // work w/out the spaces) try { return env.getPhysicalSchemas().flatCollect(new Function<PhysicalSchema, Iterable<SchemaObjectRow>>() { @Override public Iterable<SchemaObjectRow> valueOf(PhysicalSchema physicalSchema) { final String sql = String.format( "select '%1$s' schema, trim(TABNAME) name, NUM_REORG_REC_ALTERS, REORG_PENDING\n" + "FROM TABLE (SYSPROC.ADMIN_GET_TAB_INFO('%1$s', null)) WHERE REORG_PENDING = 'Y'" , physicalSchema.getPhysicalName()); LOG.debug("Executing SQL: " + sql); return stmtExecutor.getJdbcTemplate() .query(conn, sql, new BeanListHandler<SchemaObjectRow>(SchemaObjectRow.class)); } }); } catch (RuntimeException e) { // TODO would like a better way to decide on using this SQL apart from catching the exception LOG.info("Query in new >= 9.7 syntax didn't work: {} (debug log shows the full stack trace). Falling back to older (and slower) syntax", e.getMessage()); LOG.debug("Full exception stack trace", e); String sql = "SELECT TRIM(TABSCHEMA) schema, TABNAME name, NUM_REORG_REC_ALTERS, REORG_PENDING\n" + "FROM SYSIBMADM.ADMINTABINFO WHERE REORG_PENDING = 'Y'\n" + "AND TABSCHEMA IN ('" + env.getPhysicalSchemas().makeString("','") + "')"; return CollectionAdapter.wrapSet(Db2PostDeployAction.this.stmtExecutor.getJdbcTemplate() .query(conn, sql, new BeanListHandler<SchemaObjectRow>(SchemaObjectRow.class))).toImmutable(); } }
@Override public ImmutableList<Change> getDeployedChanges() { return env.getPhysicalSchemas().flatCollect(new Function<PhysicalSchema, Iterable<Change>>() { @Override public Iterable<Change> valueOf(PhysicalSchema physicalSchema) {
@Override public ImmutableList<Change> getDeployedChanges() { return env.getPhysicalSchemas().flatCollect(new Function<PhysicalSchema, Iterable<Change>>() { @Override public Iterable<Change> valueOf(PhysicalSchema physicalSchema) {
ImmutableSet<SchemaObjectRow> getTablesNeedingReorg(final Connection conn, final DbEnvironment env) { // keeping as system.out for now to facilitate output to maven output LOG.info("Starting DB2 post-deploy action: Querying for tables in reorg-ending state (this may take a minute)"); // trim the schema as DB2 seems to sometimes return the schema w/ spaces (even though where clauses can still // work w/out the spaces) try { return env.getPhysicalSchemas().flatCollect(new Function<PhysicalSchema, Iterable<SchemaObjectRow>>() { @Override public Iterable<SchemaObjectRow> valueOf(PhysicalSchema physicalSchema) { final String sql = String.format( "select '%1$s' schema, trim(TABNAME) name, NUM_REORG_REC_ALTERS, REORG_PENDING\n" + "FROM TABLE (SYSPROC.ADMIN_GET_TAB_INFO('%1$s', null)) WHERE REORG_PENDING = 'Y'" , physicalSchema.getPhysicalName()); LOG.debug("Executing SQL: " + sql); return stmtExecutor.getJdbcTemplate() .query(conn, sql, new BeanListHandler<SchemaObjectRow>(SchemaObjectRow.class)); } }); } catch (RuntimeException e) { // TODO would like a better way to decide on using this SQL apart from catching the exception LOG.info("Query in new >= 9.7 syntax didn't work: {} (debug log shows the full stack trace). Falling back to older (and slower) syntax", e.getMessage()); LOG.debug("Full exception stack trace", e); String sql = "SELECT TRIM(TABSCHEMA) schema, TABNAME name, NUM_REORG_REC_ALTERS, REORG_PENDING\n" + "FROM SYSIBMADM.ADMINTABINFO WHERE REORG_PENDING = 'Y'\n" + "AND TABSCHEMA IN ('" + env.getPhysicalSchemas().makeString("','") + "')"; return CollectionAdapter.wrapSet(Db2PostDeployAction.this.stmtExecutor.getJdbcTemplate() .query(conn, sql, new BeanListHandler<SchemaObjectRow>(SchemaObjectRow.class))).toImmutable(); } }
return physicalSchemas.flatCollect(new Function<PhysicalSchema, Iterable<CompareBreak>>() { @Override public Iterable<CompareBreak> valueOf(PhysicalSchema schema) {
return physicalSchemas.flatCollect(new Function<PhysicalSchema, Iterable<CompareBreak>>() { @Override public Iterable<CompareBreak> valueOf(PhysicalSchema schema) {