Search in sources :

Example 6 with DfDatabaseProperties

use of org.dbflute.properties.DfDatabaseProperties in project dbflute-core by dbflute.

the class DfProcedureExtractor method isSynonymAllowedSchema.

protected boolean isSynonymAllowedSchema(DfProcedureSynonymMeta procedureSynonymMetaInfo) {
    final DfSynonymMeta synonymMetaInfo = procedureSynonymMetaInfo.getSynonymMetaInfo();
    final UnifiedSchema synonymOwner = synonymMetaInfo.getSynonymOwner();
    final DfDatabaseProperties databaseProperties = getProperties().getDatabaseProperties();
    final DfAdditionalSchemaInfo additionalSchemaInfo = databaseProperties.getAdditionalSchemaInfo(synonymOwner);
    if (additionalSchemaInfo != null) {
        return additionalSchemaInfo.hasObjectTypeSynonym();
    } else {
        // as main schema
        return databaseProperties.hasObjectTypeSynonym();
    }
}
Also used : DfSynonymMeta(org.dbflute.logic.jdbc.metadata.info.DfSynonymMeta) DfAdditionalSchemaInfo(org.dbflute.properties.assistant.DfAdditionalSchemaInfo) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfDatabaseProperties(org.dbflute.properties.DfDatabaseProperties)

Example 7 with DfDatabaseProperties

use of org.dbflute.properties.DfDatabaseProperties in project dbflute-core by dbflute.

the class DfTaskControlLogic method buildAdditionalSchemaDisp.

protected String buildAdditionalSchemaDisp() {
    final DfDatabaseProperties databaseProp = getDatabaseProperties();
    final List<UnifiedSchema> additionalSchemaList = databaseProp.getAdditionalSchemaList();
    String disp;
    if (additionalSchemaList.size() == 1) {
        final UnifiedSchema unifiedSchema = additionalSchemaList.get(0);
        final String identifiedSchema = unifiedSchema.getIdentifiedSchema();
        disp = identifiedSchema;
        if (unifiedSchema.isCatalogAdditionalSchema()) {
            disp = disp + "(catalog)";
        } else if (unifiedSchema.isMainSchema()) {
            // should NOT be true
            disp = disp + "(main)";
        } else if (unifiedSchema.isUnknownSchema()) {
            // should NOT be true
            disp = disp + "(unknown)";
        }
    } else {
        final StringBuilder sb = new StringBuilder();
        for (UnifiedSchema unifiedSchema : additionalSchemaList) {
            if (sb.length() > 0) {
                sb.append(", ");
            }
            final String identifiedSchema = unifiedSchema.getIdentifiedSchema();
            sb.append(identifiedSchema);
            if (unifiedSchema.isCatalogAdditionalSchema()) {
                sb.append("(catalog)");
            } else if (unifiedSchema.isMainSchema()) {
                // should NOT be true
                sb.append("(main)");
            } else if (unifiedSchema.isUnknownSchema()) {
                // should NOT be true
                sb.append("(unknown)");
            }
        }
        disp = sb.toString();
    }
    return disp;
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfDatabaseProperties(org.dbflute.properties.DfDatabaseProperties)

Example 8 with DfDatabaseProperties

use of org.dbflute.properties.DfDatabaseProperties in project dbflute-core by dbflute.

the class DfTakeFinallyProcess method incrementSequenceToDataMax.

// -----------------------------------------------------
// Increment Sequence
// ------------------
protected void incrementSequenceToDataMax() {
    if (!getReplaceSchemaProperties().isIncrementSequenceToDataMax()) {
        return;
    }
    if (_suppressSequenceIncrement) {
        return;
    }
    _log.info("");
    _log.info("* * * * * * * * * * **");
    _log.info("*                    *");
    _log.info("* Increment Sequence *");
    _log.info("*                    *");
    _log.info("* * * * * * * * * * **");
    final DfSequenceIdentityProperties sequenceProp = getProperties().getSequenceIdentityProperties();
    final Map<String, String> tableSequenceMap = sequenceProp.getTableSequenceMap();
    final DfDatabaseTypeFacadeProp dbTypeProp = getDatabaseTypeFacadeProp();
    final DfDatabaseProperties databaseProp = getDatabaseProperties();
    final DfSequenceHandlerFactory factory = new DfSequenceHandlerFactory(_dataSource, dbTypeProp, databaseProp);
    final DfSequenceHandler sequenceHandler = factory.createSequenceHandler();
    if (sequenceHandler == null) {
        String databaseType = dbTypeProp.getTargetDatabase();
        String msg = "Unsupported isIncrementSequenceToDataMax at " + databaseType;
        throw new UnsupportedOperationException(msg);
    }
    sequenceHandler.incrementSequenceToDataMax(tableSequenceMap);
}
Also used : DfSequenceHandler(org.dbflute.logic.replaceschema.takefinally.sequence.DfSequenceHandler) DfSequenceHandlerFactory(org.dbflute.logic.replaceschema.takefinally.sequence.factory.DfSequenceHandlerFactory) DfDatabaseTypeFacadeProp(org.dbflute.properties.facade.DfDatabaseTypeFacadeProp) DfSequenceIdentityProperties(org.dbflute.properties.DfSequenceIdentityProperties) DfDatabaseProperties(org.dbflute.properties.DfDatabaseProperties)

Example 9 with DfDatabaseProperties

use of org.dbflute.properties.DfDatabaseProperties in project dbflute-core by dbflute.

the class DfSchemaXmlSerializer method createSequenceExtractorFactory.

protected DfSequenceExtractorFactory createSequenceExtractorFactory(DfSchemaSource dataSource) {
    final DfDatabaseTypeFacadeProp facadeProp = getProperties().getBasicProperties().getDatabaseTypeFacadeProp();
    final DfDatabaseProperties databaseProp = getDatabaseProperties();
    final DfSequenceExtractorFactory factory = new DfSequenceExtractorFactory(dataSource, facadeProp, databaseProp);
    if (_suppressAdditionalSchema) {
        factory.suppressAdditionalSchema();
    }
    return factory;
}
Also used : DfSequenceExtractorFactory(org.dbflute.logic.jdbc.metadata.sequence.factory.DfSequenceExtractorFactory) DfDatabaseTypeFacadeProp(org.dbflute.properties.facade.DfDatabaseTypeFacadeProp) DfDatabaseProperties(org.dbflute.properties.DfDatabaseProperties)

Aggregations

DfDatabaseProperties (org.dbflute.properties.DfDatabaseProperties)9 DfAdditionalSchemaInfo (org.dbflute.properties.assistant.DfAdditionalSchemaInfo)4 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)3 DfRunnerInformation (org.dbflute.helper.jdbc.DfRunnerInformation)2 DfDatabaseTypeFacadeProp (org.dbflute.properties.facade.DfDatabaseTypeFacadeProp)2 DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)1 DfSynonymMeta (org.dbflute.logic.jdbc.metadata.info.DfSynonymMeta)1 DfSequenceExtractorFactory (org.dbflute.logic.jdbc.metadata.sequence.factory.DfSequenceExtractorFactory)1 DfSequenceHandler (org.dbflute.logic.replaceschema.takefinally.sequence.DfSequenceHandler)1 DfSequenceHandlerFactory (org.dbflute.logic.replaceschema.takefinally.sequence.factory.DfSequenceHandlerFactory)1 DfSequenceIdentityProperties (org.dbflute.properties.DfSequenceIdentityProperties)1