use of org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta in project dbflute-core by dbflute.
the class DfPmbMetaData method needsPostgreSQLByteaHandling.
public boolean needsPostgreSQLByteaHandling(String propertyName) {
assertArgumentPmbMetaDataPropertyName(propertyName);
final DfProcedureColumnMeta metaInfo = getProcedureColumnInfo(propertyName);
return metaInfo != null && _columnHandler.isPostgreSQLBytea(metaInfo.getDbTypeName());
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta in project dbflute-core by dbflute.
the class DfPmbMetaData method needsOracleArrayHandling.
public boolean needsOracleArrayHandling(String propertyName) {
assertArgumentPmbMetaDataPropertyName(propertyName);
if (!getBasicProperties().isDatabaseOracle() || !getLittleAdjustmentProperties().isAvailableDatabaseNativeJDBC()) {
return false;
}
final DfProcedureColumnMeta metaInfo = getProcedureColumnInfo(propertyName);
return metaInfo != null && metaInfo.hasTypeArrayInfo();
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta in project dbflute-core by dbflute.
the class DfPmbMetaData method needsBytesBlobHandling.
public boolean needsBytesBlobHandling(String propertyName) {
assertArgumentPmbMetaDataPropertyName(propertyName);
final DfProcedureColumnMeta metaInfo = getProcedureColumnInfo(propertyName);
return metaInfo != null && _columnHandler.isConceptTypeBytesBlob(metaInfo.getDbTypeName());
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta in project dbflute-core by dbflute.
the class DfPmbMetaData method getProcedureParameterOracleStructTypeName.
public String getProcedureParameterOracleStructTypeName(String propertyName) {
assertArgumentPmbMetaDataPropertyName(propertyName);
final DfProcedureColumnMeta columnInfo = getProcedureColumnInfo(propertyName);
if (columnInfo != null && columnInfo.hasTypeStructInfo()) {
return columnInfo.getTypeStructInfo().getTypeSqlName();
}
return "";
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method setupProcedureColumnMetaInfo.
protected void setupProcedureColumnMetaInfo(DfProcedureMeta procedureMetaInfo, ResultSet columnRs) throws SQLException {
final Set<String> uniqueSet = new HashSet<String>();
while (columnRs.next()) {
// /- - - - - - - - - - - - - - - - - - - - - - - -
// same policy as table process about JDBC handling
// (see DfTableHandler.java)
// - - - - - - - - - -/
final String columnName = columnRs.getString("COLUMN_NAME");
// because Oracle package procedure may return them
if (uniqueSet.contains(columnName)) {
continue;
}
uniqueSet.add(columnName);
final Integer procedureColumnType;
{
final String columnType = columnRs.getString("COLUMN_TYPE");
final int unknowType = DatabaseMetaData.procedureColumnUnknown;
if (Srl.is_NotNull_and_NotTrimmedEmpty(columnType)) {
procedureColumnType = toInt("columnType", columnType);
} else {
procedureColumnType = unknowType;
}
}
final int jdbcType;
{
int tmpJdbcType = Types.OTHER;
String dataType = null;
try {
dataType = columnRs.getString("DATA_TYPE");
} catch (RuntimeException ignored) {
// pinpoint patch
// for example, SQLServer throws an exception
// if the procedure is a function that returns table type
final String procdureName = procedureMetaInfo.getProcedureFullQualifiedName();
log("*Failed to get data type: " + procdureName + "." + columnName);
tmpJdbcType = Types.OTHER;
}
if (Srl.is_NotNull_and_NotTrimmedEmpty(dataType)) {
tmpJdbcType = toInt("dataType", dataType);
}
jdbcType = tmpJdbcType;
}
final String dbTypeName = columnRs.getString("TYPE_NAME");
// uses getString() to get null value
// (getInt() returns zero when a value is no defined)
final Integer columnSize;
{
final String precision = columnRs.getString("PRECISION");
if (Srl.is_NotNull_and_NotTrimmedEmpty(precision)) {
columnSize = toInt("precision", precision);
} else {
final String length = columnRs.getString("LENGTH");
if (Srl.is_NotNull_and_NotTrimmedEmpty(length)) {
columnSize = toInt("length", length);
} else {
columnSize = null;
}
}
}
final Integer decimalDigits;
{
final String scale = columnRs.getString("SCALE");
if (Srl.is_NotNull_and_NotTrimmedEmpty(scale)) {
decimalDigits = toInt("scale", scale);
} else {
decimalDigits = null;
}
}
final String columnComment = columnRs.getString("REMARKS");
final DfProcedureColumnMeta procedureColumnMetaInfo = new DfProcedureColumnMeta();
procedureColumnMetaInfo.setColumnName(columnName);
if (procedureColumnType == DatabaseMetaData.procedureColumnUnknown) {
procedureColumnMetaInfo.setProcedureColumnType(DfProcedureColumnType.procedureColumnUnknown);
} else if (procedureColumnType == DatabaseMetaData.procedureColumnIn) {
procedureColumnMetaInfo.setProcedureColumnType(DfProcedureColumnType.procedureColumnIn);
} else if (procedureColumnType == DatabaseMetaData.procedureColumnInOut) {
procedureColumnMetaInfo.setProcedureColumnType(DfProcedureColumnType.procedureColumnInOut);
} else if (procedureColumnType == DatabaseMetaData.procedureColumnOut) {
procedureColumnMetaInfo.setProcedureColumnType(DfProcedureColumnType.procedureColumnOut);
} else if (procedureColumnType == DatabaseMetaData.procedureColumnReturn) {
procedureColumnMetaInfo.setProcedureColumnType(DfProcedureColumnType.procedureColumnReturn);
} else if (procedureColumnType == DatabaseMetaData.procedureColumnResult) {
procedureColumnMetaInfo.setProcedureColumnType(DfProcedureColumnType.procedureColumnResult);
} else {
throw new IllegalStateException("Unknown procedureColumnType: " + procedureColumnType);
}
procedureColumnMetaInfo.setJdbcDefType(jdbcType);
procedureColumnMetaInfo.setDbTypeName(dbTypeName);
procedureColumnMetaInfo.setColumnSize(columnSize);
procedureColumnMetaInfo.setDecimalDigits(decimalDigits);
procedureColumnMetaInfo.setColumnComment(columnComment);
procedureMetaInfo.addProcedureColumn(procedureColumnMetaInfo);
}
adjustProcedureColumnList(procedureMetaInfo);
}
Aggregations