protected boolean isReady() { boolean r = this.ready; if (!r) { r = JdbcUtils.doesTableExist(this.jdbcOperations, Table.NAME); if (r) { this.ready = r; } } return r; } }
protected boolean isReady() { boolean r = this.ready; if (!r) { r = JdbcUtils.doesTableExist(this.jdbcOperations, Table.NAME); if (r) { this.ready = r; } } return r; } }
/** * Check if the named table exists, if it does drop it, calling the preDropCallback first * * @param jdbcOperations {@link JdbcOperations} used to check if the table exists and execute * the drop * @param table The name of the table to drop, case insensitive * @param preDropCallback The callback to execute immediately before the table is dropped * @return The result returned from the callback */ public static final <T> T dropTableIfExists( JdbcOperations jdbcOperations, final String table, final Function<JdbcOperations, T> preDropCallback) { LOGGER.info("Dropping table: " + table); final boolean tableExists = doesTableExist(jdbcOperations, table); if (tableExists) { final T ret = preDropCallback.apply(jdbcOperations); jdbcOperations.execute("DROP TABLE " + table); return ret; } return null; }
/** * Check if the named table exists, if it does drop it, calling the preDropCallback first * * @param jdbcOperations {@link JdbcOperations} used to check if the table exists and execute * the drop * @param table The name of the table to drop, case insensitive * @param preDropCallback The callback to execute immediately before the table is dropped * @return The result returned from the callback */ public static final <T> T dropTableIfExists( JdbcOperations jdbcOperations, final String table, final Function<JdbcOperations, T> preDropCallback) { LOGGER.info("Dropping table: " + table); final boolean tableExists = doesTableExist(jdbcOperations, table); if (tableExists) { final T ret = preDropCallback.apply(jdbcOperations); jdbcOperations.execute("DROP TABLE " + table); return ret; } return null; }