use of org.dbflute.logic.jdbc.metadata.basic.DfTableExtractor in project dbflute-core by dbflute.
the class DfSequenceHandlerJdbc method initializeTableInfo.
protected void initializeTableInfo(Connection conn) throws SQLException {
if (_tableMap != null) {
return;
}
_tableMap = StringKeyMap.createAsFlexible();
final DfTableExtractor tableHandler = new DfTableExtractor();
final DatabaseMetaData metaData = conn.getMetaData();
final List<UnifiedSchema> unifiedSchemaList = _unifiedSchemaList;
for (UnifiedSchema unifiedSchema : unifiedSchemaList) {
// same-name tables between different schemas are unsupported
// so put all directly here
_tableMap.putAll(tableHandler.getTableMap(metaData, unifiedSchema));
}
}
use of org.dbflute.logic.jdbc.metadata.basic.DfTableExtractor in project dbflute-core by dbflute.
the class DfConventionalTakeAsserter method extractTableList.
protected List<DfTableMeta> extractTableList() {
Connection conn = null;
try {
conn = _dataSource.getConnection();
final DatabaseMetaData metaData = conn.getMetaData();
return new DfTableExtractor().getTableList(metaData, _dataSource.getSchema());
} catch (SQLException e) {
throw new SQLFailureException("Failed to extract table meta list: " + _dataSource, e);
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException ignored) {
}
}
}
}
use of org.dbflute.logic.jdbc.metadata.basic.DfTableExtractor in project dbflute-core by dbflute.
the class DfSchemaInitializerJdbc method initializeSchema.
// ===================================================================================
// Initialize Schema
// =================
public void initializeSchema() {
Connection conn = null;
try {
try {
conn = _dataSource.getConnection();
} catch (SQLException e) {
if (_suppressConnectionFailure) {
handleSuppressedConnectionFailure(e);
return;
} else {
throw e;
}
}
final List<DfTableMeta> tableMetaList;
try {
final DatabaseMetaData metaData = conn.getMetaData();
final DfTableExtractor tableExtractor = createDropTableExtractor();
tableMetaList = tableExtractor.getTableList(metaData, _unifiedSchema);
} catch (SQLException e) {
throw new RuntimeException(e);
}
executeObject(conn, tableMetaList);
} catch (SQLException e) {
String msg = "Failed to the initialize schema: " + _unifiedSchema;
throw new SQLFailureException(msg, e);
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException ignored) {
_log.info("connection.close() threw the exception!", ignored);
}
}
}
}
use of org.dbflute.logic.jdbc.metadata.basic.DfTableExtractor in project dbflute-core by dbflute.
the class DfRepsSequenceHandlerJdbc method initializeTableInfo.
protected void initializeTableInfo(Connection conn) throws SQLException {
if (_tableMap != null) {
return;
}
_tableMap = StringKeyMap.createAsFlexible();
final DfTableExtractor tableHandler = new DfTableExtractor();
final DatabaseMetaData metaData = conn.getMetaData();
final List<UnifiedSchema> unifiedSchemaList = _unifiedSchemaList;
for (UnifiedSchema unifiedSchema : unifiedSchemaList) {
// same-name tables between different schemas are unsupported
// so put all directly here
_tableMap.putAll(tableHandler.getTableMap(metaData, unifiedSchema));
}
}
Aggregations