Search in sources :

Example 51 with UnifiedSchema

use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.

the class DfSchemaInitializerFactory method setupSchemaInitializerJdbcProperties.

protected void setupSchemaInitializerJdbcProperties(DfSchemaInitializerJdbc initializer) {
    setupDetailExecutionHandling(initializer);
    if (_initializeType.equals(InitializeType.MAIN)) {
        initializer.setDataSource(_dataSource);
        initializer.setUnifiedSchema(_databaseProperties.getDatabaseSchema());
        initializer.setDropObjectTypeList(_replaceSchemaProperties.getObjectTypeTargetList());
        initializer.setInitializeFirstSqlList(_replaceSchemaProperties.getInitializeFirstSqlList());
        initializer.setDropTableExceptList(_replaceSchemaProperties.getDropTableExceptList());
        initializer.setDropSequenceExceptList(_replaceSchemaProperties.getDropSequenceExceptList());
        initializer.setDropProcedureExceptList(_replaceSchemaProperties.getDropProcedureExceptList());
        return;
    }
    if (_initializeType.equals(InitializeType.ADDTIONAL)) {
        // Here 'Additional'!
        if (_additionalDropMap == null) {
            String msg = "The additional drop map should exist if the initialize type is additional!";
            throw new IllegalStateException(msg);
        }
        initializer.setDataSource(getAdditionalDataSource());
        final UnifiedSchema unifiedSchema = getAdditionalDropSchema(_additionalDropMap);
        initializer.setUnifiedSchema(unifiedSchema);
        initializer.setDropObjectTypeList(getAdditionalDropObjectTypeList(_additionalDropMap));
        initializer.setSuppressConnectionFailure(isSuppressAdditionalDropSchemaConnectionFailure(_additionalDropMap));
        // initializer.setDropProcedureExceptList(null);
        return;
    }
    String msg = "Unknown initialize type: " + _initializeType;
    throw new IllegalStateException(msg);
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema)

Example 52 with UnifiedSchema

use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.

the class DfLoadDataProcess method createAsCore.

public static DfLoadDataProcess createAsCore(String sqlRootDir, DataSource dataSource, boolean previous) {
    final UnifiedSchema mainSchema = getDatabaseProperties().getDatabaseSchema();
    final DfLoadDataProcess process = new DfLoadDataProcess(sqlRootDir, dataSource, mainSchema);
    if (previous) {
        process.suppressCheckColumnDef();
        process.suppressCheckImplicitSet();
    }
    return process;
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema)

Example 53 with UnifiedSchema

use of org.apache.torque.engine.database.model.UnifiedSchema 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));
    }
}
Also used : DfTableExtractor(org.dbflute.logic.jdbc.metadata.basic.DfTableExtractor) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DatabaseMetaData(java.sql.DatabaseMetaData)

Example 54 with UnifiedSchema

use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.

the class DfColumnExtractor method getColumnList.

// ===================================================================================
// Meta Getting
// ============
/**
 * Get the list of column meta information.
 * @param metaData The meta data of database. (NotNull)
 * @param tableInfo The meta information of table. (NotNull)
 * @return The list of column meta information. (NotNull)
 */
public List<DfColumnMeta> getColumnList(DatabaseMetaData metaData, DfTableMeta tableInfo) throws SQLException {
    final UnifiedSchema unifiedSchema = tableInfo.getUnifiedSchema();
    final String tableName = tableInfo.getTableName();
    return getColumnList(metaData, unifiedSchema, tableName);
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema)

Example 55 with UnifiedSchema

use of org.apache.torque.engine.database.model.UnifiedSchema in project dbflute-core by dbflute.

the class DfSynonymExtractorOracle method buildSynonymSelect.

protected String buildSynonymSelect() {
    final StringBuilder sb = new StringBuilder();
    int count = 0;
    for (UnifiedSchema unifiedSchema : _unifiedSchemaList) {
        if (count > 0) {
            sb.append(", ");
        }
        sb.append("'").append(unifiedSchema.getPureSchema()).append("'");
        ++count;
    }
    final String sql = "select * from ALL_SYNONYMS where OWNER in (" + sb.toString() + ")";
    return sql;
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema)

Aggregations

UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)63 Map (java.util.Map)9 StringKeyMap (org.dbflute.helper.StringKeyMap)9 DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)8 LinkedHashMap (java.util.LinkedHashMap)7 ResultSet (java.sql.ResultSet)6 DfSynonymMeta (org.dbflute.logic.jdbc.metadata.info.DfSynonymMeta)6 DfTableMeta (org.dbflute.logic.jdbc.metadata.info.DfTableMeta)6 ArrayList (java.util.ArrayList)5 LinkedHashSet (java.util.LinkedHashSet)4 DfProcedureSupplementExtractor (org.dbflute.logic.jdbc.metadata.procedure.DfProcedureSupplementExtractor)4 List (java.util.List)3 TreeMap (java.util.TreeMap)3 TypeMap (org.apache.torque.engine.database.model.TypeMap)3 DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)3 DfAdditionalSchemaInfo (org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo)3 Connection (java.sql.Connection)2 DatabaseMetaData (java.sql.DatabaseMetaData)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2