use of org.dbflute.logic.jdbc.metadata.info.DfSequenceMeta in project dbflute-core by dbflute.
the class DfSequenceExtractorOracle method setupSequenceSynonym.
protected void setupSequenceSynonym(Map<String, DfSequenceMeta> resultMap, StringBuilder logSb) {
final List<String> columnList = new ArrayList<String>();
columnList.add("SYNONYM_OWNER");
columnList.add("SYNONYM_NAME");
columnList.add("SEQUENCE_OWNER");
columnList.add("SEQUENCE_NAME");
columnList.add("MIN_VALUE");
columnList.add("MAX_VALUE");
columnList.add("INCREMENT_BY");
final String sql = buildSequenceSynonymSelectSql();
if (sql == null) {
return;
}
final List<Map<String, String>> synonymList = selectStringList(sql, columnList);
for (Map<String, String> recordMap : synonymList) {
final DfSequenceMeta info = new DfSequenceMeta();
final String sequenceSchema = recordMap.get("SYNONYM_OWNER");
info.setSequenceSchema(sequenceSchema);
final String sequenceName = recordMap.get("SYNONYM_NAME");
info.setSequenceName(sequenceName);
final String minValue = recordMap.get("MIN_VALUE");
info.setMinimumValue(minValue != null ? new BigDecimal(minValue) : null);
final String maxValue = recordMap.get("MAX_VALUE");
info.setMaximumValue(maxValue != null ? new BigDecimal(maxValue) : null);
final String incrementSize = recordMap.get("INCREMENT_BY");
info.setIncrementSize(incrementSize != null ? Integer.valueOf(incrementSize) : null);
final String key = buildSequenceMapKey(null, sequenceSchema, sequenceName);
resultMap.put(key, info);
logSb.append(ln()).append(" ").append(key).append(" = ").append(info.toString());
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfSequenceMeta in project dbflute-core by dbflute.
the class DfSequenceExtractorOracle method setupPureSequence.
protected void setupPureSequence(Map<String, DfSequenceMeta> resultMap, StringBuilder logSb) {
final String sql = buildMetaSelectSql();
if (sql == null) {
return;
}
final List<String> columnList = new ArrayList<String>();
columnList.add("SEQUENCE_OWNER");
columnList.add("SEQUENCE_NAME");
columnList.add("MIN_VALUE");
columnList.add("MAX_VALUE");
columnList.add("INCREMENT_BY");
final List<Map<String, String>> resultList = selectStringList(sql, columnList);
logSb.append(ln()).append("[SEQUENCE]");
for (Map<String, String> recordMap : resultList) {
final DfSequenceMeta info = new DfSequenceMeta();
final String sequenceSchema = recordMap.get("SEQUENCE_OWNER");
info.setSequenceSchema(sequenceSchema);
final String sequenceName = recordMap.get("SEQUENCE_NAME");
info.setSequenceName(sequenceName);
final String minValue = recordMap.get("MIN_VALUE");
info.setMinimumValue(minValue != null ? new BigDecimal(minValue) : null);
final String maxValue = recordMap.get("MAX_VALUE");
info.setMaximumValue(maxValue != null ? new BigDecimal(maxValue) : null);
final String incrementSize = recordMap.get("INCREMENT_BY");
info.setIncrementSize(incrementSize != null ? Integer.valueOf(incrementSize) : null);
final String key = buildSequenceMapKey(null, sequenceSchema, sequenceName);
resultMap.put(key, info);
logSb.append(ln()).append(" ").append(key).append(" = ").append(info.toString());
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfSequenceMeta in project dbflute-core by dbflute.
the class DfSchemaXmlSerializer method processSequence.
// -----------------------------------------------------
// Sequence
// --------
protected void processSequence(Connection conn, DatabaseMetaData metaData) throws SQLException {
_log.info("...Getting sequences");
final Map<String, DfSequenceMeta> sequenceMap = extractSequenceMap();
if (sequenceMap == null) {
// means sequence-not-supported DBMS
return;
}
_log.info("...Processing sequences: " + sequenceMap.size());
final Element sequenceGroupElement = _doc.createElement("sequenceGroup");
for (Entry<String, DfSequenceMeta> entry : sequenceMap.entrySet()) {
final DfSequenceMeta sequenceMeta = entry.getValue();
doProcessSequence(sequenceGroupElement, sequenceMeta);
}
_databaseNode.appendChild(sequenceGroupElement);
}
use of org.dbflute.logic.jdbc.metadata.info.DfSequenceMeta in project dbflute-core by dbflute.
the class DfSchemaXmlSerializer method extractSequenceMap.
protected Map<String, DfSequenceMeta> extractSequenceMap() {
final DfSequenceExtractorFactory factory = createSequenceExtractorFactory(_dataSource);
final DfSequenceExtractor sequenceExtractor = factory.createSequenceExtractor();
Map<String, DfSequenceMeta> sequenceMap = null;
if (sequenceExtractor != null) {
sequenceMap = sequenceExtractor.extractSequenceMap();
}
return sequenceMap;
}
use of org.dbflute.logic.jdbc.metadata.info.DfSequenceMeta in project dbflute-core by dbflute.
the class DfSequenceIdentityProperties method getSequenceMap.
public Map<String, DfSequenceMeta> getSequenceMap(DfSchemaSource dataSource) {
if (_sequenceMap != null) {
return _sequenceMap;
}
final DfSequenceExtractorFactory factory = createSequenceExtractorFactory(dataSource);
final DfSequenceExtractor sequenceExtractor = factory.createSequenceExtractor();
Map<String, DfSequenceMeta> sequenceMap = null;
if (sequenceExtractor != null) {
sequenceMap = sequenceExtractor.extractSequenceMap();
}
if (sequenceMap != null) {
_sequenceMap = sequenceMap;
} else {
_sequenceMap = DfCollectionUtil.emptyMap();
}
return _sequenceMap;
}
Aggregations