Search in sources :

Example 1 with DfDatetimePrecisionExtractor

use of org.dbflute.logic.jdbc.metadata.supplement.DfDatetimePrecisionExtractor in project dbflute-core by dbflute.

the class DfSchemaXmlSerializer method doHelpTableDatePrecision.

protected void doHelpTableDatePrecision(List<DfTableMeta> tableList, UnifiedSchema unifiedSchema) {
    final DfDatetimePrecisionExtractor datetimePrecisionExtractor = createDatetimePrecisionExtractor(unifiedSchema);
    if (datetimePrecisionExtractor != null) {
        final Set<String> tableSet = new HashSet<String>();
        for (DfTableMeta table : tableList) {
            tableSet.add(table.getTableName());
        }
        try {
            if (_datetimePrecisionAllMap == null) {
                _datetimePrecisionAllMap = new LinkedHashMap<UnifiedSchema, Map<String, Map<String, Integer>>>();
            }
            final Map<String, Map<String, Integer>> datetimePrecisionMap = _datetimePrecisionAllMap.get(unifiedSchema);
            final Map<String, Map<String, Integer>> extractedMap = datetimePrecisionExtractor.extractDatetimePrecisionMap(tableSet);
            if (datetimePrecisionMap == null) {
                _datetimePrecisionAllMap.put(unifiedSchema, extractedMap);
            } else {
                // basically no way, schema is unique but just in case
                // merge
                datetimePrecisionMap.putAll(extractedMap);
            }
        } catch (RuntimeException continued) {
            _log.info("Failed to extract date-time precisions: extractor=" + datetimePrecisionExtractor, continued);
        }
    }
}
Also used : DfDatetimePrecisionExtractor(org.dbflute.logic.jdbc.metadata.supplement.DfDatetimePrecisionExtractor) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfTableMeta(org.dbflute.logic.jdbc.metadata.info.DfTableMeta) Map(java.util.Map) TypeMap(org.apache.torque.engine.database.model.TypeMap) LinkedHashMap(java.util.LinkedHashMap) TreeMap(java.util.TreeMap) StringKeyMap(org.dbflute.helper.StringKeyMap) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 TypeMap (org.apache.torque.engine.database.model.TypeMap)1 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)1 StringKeyMap (org.dbflute.helper.StringKeyMap)1 DfTableMeta (org.dbflute.logic.jdbc.metadata.info.DfTableMeta)1 DfDatetimePrecisionExtractor (org.dbflute.logic.jdbc.metadata.supplement.DfDatetimePrecisionExtractor)1