use of org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo 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);
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo in project dbflute-core by dbflute.
the class DfProcedureSupplementExtractorMySQL method doExtractProcedureSourceInfo.
// ===================================================================================
// Source Info
// ===========
@Override
protected Map<String, DfProcedureSourceInfo> doExtractProcedureSourceInfo(UnifiedSchema unifiedSchema) {
final List<Map<String, String>> sourceList = selectProcedureSourceList(unifiedSchema);
final Map<String, DfProcedureSourceInfo> resultMap = StringKeyMap.createAsFlexibleOrdered();
for (Map<String, String> sourceMap : sourceList) {
final String name = sourceMap.get("ROUTINE_NAME");
if (name == null) {
// just in case
continue;
}
final DfProcedureSourceInfo sourceInfo = new DfProcedureSourceInfo();
// ROUTINES does not have parameter list
final String body = sourceMap.get("ROUTINE_DEFINITION");
if (body == null) {
continue;
}
sourceInfo.setSourceCode(body);
// body part only
sourceInfo.setSourceLine(calculateSourceLine(body));
sourceInfo.setSourceSize(calculateSourceSize(body));
resultMap.put(name, sourceInfo);
}
return resultMap;
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo in project dbflute-core by dbflute.
the class DfProcedureSupplementExtractorH2 method doExtractProcedureSourceInfo.
// ===================================================================================
// Source Info
// ===========
@Override
protected Map<String, DfProcedureSourceInfo> doExtractProcedureSourceInfo(UnifiedSchema unifiedSchema) {
final List<Map<String, String>> sourceList = selectProcedureSourceList(unifiedSchema);
final Map<String, DfProcedureSourceInfo> resultMap = StringKeyMap.createAsFlexibleOrdered();
for (Map<String, String> sourceMap : sourceList) {
final String name = sourceMap.get("ALIAS_NAME");
if (name == null) {
// just in case
continue;
}
final DfProcedureSourceInfo sourceInfo = new DfProcedureSourceInfo();
// full text
final String body = sourceMap.get("SOURCE");
if (body == null) {
continue;
}
sourceInfo.setSourceCode(body);
sourceInfo.setSourceLine(calculateSourceLine(body));
sourceInfo.setSourceSize(calculateSourceSize(body));
resultMap.put(name, sourceInfo);
}
return resultMap;
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo in project dbflute-core by dbflute.
the class DfProcedureExtractor method doSetupSourceInfo.
// ===================================================================================
// Source Info
// ===========
protected void doSetupSourceInfo(DataSource dataSource, List<DfProcedureMeta> metaInfoList, DfProcedureSupplementExtractor extractor, UnifiedSchema unifiedSchema, boolean reflectParamsToHash) {
final Map<String, DfProcedureSourceInfo> sourceInfoMap = extractor.extractProcedureSourceInfo(unifiedSchema);
if (sourceInfoMap == null) {
return;
}
log("...Reflecting source info to procedure meta: schema=" + unifiedSchema.getCatalogSchema());
for (DfProcedureMeta procedureMeta : metaInfoList) {
final UnifiedSchema procedureSchema = procedureMeta.getProcedureSchema();
if (!unifiedSchema.equals(procedureSchema)) {
continue;
}
final DfProcedureSourceInfo sourceInfo = sourceInfoMap.get(procedureMeta.getProcedureName());
if (sourceInfo == null) {
continue;
}
if (reflectParamsToHash) {
sourceInfo.setSupplementCode(procedureMeta.getColumnDefinitionIndentity());
}
showReflectedSourceInfo(procedureMeta, sourceInfo);
procedureMeta.setProcedureSourceInfo(sourceInfo);
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo in project dbflute-core by dbflute.
the class DfProcedureSupplementExtractorOracle method setupProcedureSourceInfo.
protected void setupProcedureSourceInfo(Map<String, DfProcedureSourceInfo> resultMap, String procedureName, String sourceCode, int line) {
final DfProcedureSourceInfo sourceInfo = new DfProcedureSourceInfo();
sourceInfo.setSourceCode(sourceCode.trim());
sourceInfo.setSourceLine(line);
sourceInfo.setSourceSize(sourceCode.length());
final DfProcedureSourceInfo existingInfo = resultMap.get(procedureName);
if (existingInfo != null) {
// means e.g. split overload
mergeExistingSourceInfo(sourceInfo, existingInfo);
} else {
// basically here
resultMap.put(procedureName, sourceInfo);
}
}
Aggregations