Search in sources :

Example 1 with UnifiedSchema

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

the class DfTakeFinallyProcess method createAsPrevious.

public static DfTakeFinallyProcess createAsPrevious(final String sqlRootDir, DataSource dataSource) {
    final UnifiedSchema mainSchema = getDatabaseProperties().getDatabaseSchema();
    final DfTakeFinallyProcess process = new DfTakeFinallyProcess(sqlRootDir, dataSource, mainSchema, null, null);
    // and other settings are same as core
    return process.suppressConventionalTakeAssert().suppressSequenceIncrement();
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema)

Example 2 with UnifiedSchema

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

the class DfReplaceSchemaProperties method getAdditionalDropSchema.

public UnifiedSchema getAdditionalDropSchema(Map<String, Object> additionalDropMap) {
    final String url = getAdditionalDropUrl(additionalDropMap);
    final String catalog;
    if (Srl.is_NotNull_and_NotTrimmedEmpty(url)) {
        final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
        final DfUrlAnalyzer analyzer = factory.createAnalyzer();
        catalog = analyzer.extractCatalog();
    } else {
        catalog = getDatabaseProperties().getDatabaseCatalog();
    }
    final Object obj = additionalDropMap.get("schema");
    if (obj == null) {
        if (!isDatabaseAsSchemaSpecificationOmittable()) {
            String msg = "The schema is required:";
            msg = msg + " additionalDropMap=" + additionalDropMap;
            throw new DfRequiredPropertyNotFoundException(msg);
        }
        return null;
    }
    final String schema = castToString(obj, "additionalDropMapList.schema");
    final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(catalog, schema);
    return unifiedSchema;
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer) DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfUrlAnalyzerFactory(org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory)

Example 3 with UnifiedSchema

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

the class DfSchemaXmlSerializer method doProcessSequence.

protected void doProcessSequence(Element sequenceGroupElement, final DfSequenceMeta sequenceMeta) {
    final Element sequenceElement = _doc.createElement("sequence");
    sequenceElement.setAttribute("name", sequenceMeta.getSequenceName());
    final String sequenceCatalog = sequenceMeta.getSequenceCatalog();
    final String sequenceSchema = sequenceMeta.getSequenceSchema();
    final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(sequenceCatalog, sequenceSchema);
    if (unifiedSchema.hasSchema()) {
        sequenceElement.setAttribute("schema", unifiedSchema.getIdentifiedSchema());
    }
    setupSequenceAttributeNumber(sequenceMeta, sequenceElement, "minimumValue", sequenceMeta.getMinimumValue());
    setupSequenceAttributeNumber(sequenceMeta, sequenceElement, "maximumValue", sequenceMeta.getMaximumValue());
    setupSequenceAttributeNumber(sequenceMeta, sequenceElement, "incrementSize", sequenceMeta.getIncrementSize());
    // no sequence meta now (2012/08/21)
    // sequenceElement.setAttribute("comment", null);
    sequenceGroupElement.appendChild(sequenceElement);
}
Also used : Element(org.w3c.dom.Element) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema)

Example 4 with UnifiedSchema

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

the class DfSchemaXmlSerializer method resolveAdditionalSchema.

protected void resolveAdditionalSchema(DatabaseMetaData dbMeta, List<DfTableMeta> tableList) throws SQLException {
    if (_suppressAdditionalSchema) {
        return;
    }
    final List<UnifiedSchema> schemaList = getDatabaseProperties().getAdditionalSchemaList();
    for (UnifiedSchema additionalSchema : schemaList) {
        final List<DfTableMeta> additionalTableList = _tableExtractor.getTableList(dbMeta, additionalSchema);
        helpTableBasicSupplement(additionalTableList, additionalSchema);
        tableList.addAll(additionalTableList);
    }
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfTableMeta(org.dbflute.logic.jdbc.metadata.info.DfTableMeta)

Example 5 with UnifiedSchema

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

the class DfSchemaXmlSerializer method doProcessProcedure.

protected void doProcessProcedure(Element procedureGroupElement, final DfProcedureMeta procedureMeta) {
    final Element procedureElement = _doc.createElement("procedure");
    procedureElement.setAttribute("name", procedureMeta.getProcedureName());
    final UnifiedSchema unifiedSchema = procedureMeta.getProcedureSchema();
    if (unifiedSchema.hasSchema()) {
        procedureElement.setAttribute("schema", unifiedSchema.getIdentifiedSchema());
    }
    final String noMetaMark = DfSchemaDiff.PROCEDURE_SOURCE_NO_META_MARK;
    final DfProcedureSourceInfo sourceInfo = procedureMeta.getProcedureSourceInfo();
    {
        final Integer sourceLine = sourceInfo != null ? sourceInfo.getSourceLine() : null;
        procedureElement.setAttribute("sourceLine", sourceLine != null ? sourceLine.toString() : noMetaMark);
    }
    {
        final Integer sourceSize = sourceInfo != null ? sourceInfo.getSourceSize() : null;
        procedureElement.setAttribute("sourceSize", sourceSize != null ? sourceSize.toString() : noMetaMark);
    }
    {
        final String sourceHash = sourceInfo != null ? sourceInfo.toSourceHash() : null;
        procedureElement.setAttribute("sourceHash", sourceHash != null ? sourceHash : noMetaMark);
    }
    final String procedureComment = procedureMeta.getProcedureComment();
    if (Srl.is_NotNull_and_NotTrimmedEmpty(procedureComment)) {
        procedureElement.setAttribute("comment", procedureComment);
    }
    procedureGroupElement.appendChild(procedureElement);
}
Also used : DfProcedureSourceInfo(org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo) Element(org.w3c.dom.Element) 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