本文整理匯總了Java中java.sql.ParameterMetaData.parameterNullable方法的典型用法代碼示例。如果您正苦於以下問題:Java ParameterMetaData.parameterNullable方法的具體用法?Java ParameterMetaData.parameterNullable怎麽用?Java ParameterMetaData.parameterNullable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.sql.ParameterMetaData
的用法示例。
在下文中一共展示了ParameterMetaData.parameterNullable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parameterIsNullableInStringForm
import java.sql.ParameterMetaData; //導入方法依賴的package包/類
/**
* print the parameter isNullable value in human readable form
*
* @param nullabilityValue
*/
// @return the nullability status of the given parameter
static String parameterIsNullableInStringForm(int nullabilityValue){
if (nullabilityValue == ParameterMetaData.parameterNoNulls)
return("PARAMETER_NO_NULLS");
else if (nullabilityValue == ParameterMetaData.parameterNullable)
return("PARAMETER_NULLABLE");
else if (nullabilityValue == ParameterMetaData.parameterNullableUnknown)
return("PARAMETER_NULLABLE_UNKNOWN");
else
return("ERROR: donot recognize this parameter isNullable() value");
}
示例2: setProcedure
import java.sql.ParameterMetaData; //導入方法依賴的package包/類
/**
* @param procedure The procedure to set.
* @param columns columns
* @exception Exception Description of Exception
*/
public void setProcedure(String procedure, ArrayList columns) throws Exception {
if (isconfigured) { return; }
if (poolConnectionHandler != null) {
con = poolConnectionHandler.getConnection();
if (!isConnected()) { throw new Exception(
"JDBCLogger::setProcedure(), Given connection isnt connected to database !"); }
}
this.procedure = procedure;
// prepare call
CallableStatement cStmt = this.createCallableStatement(columns.size());
JDBCLogColumn logcol;
ParameterMetaData pmd;
// 2.6.2005 jschmied
// ParameterMetaData is supported on different levels by Oracle
try {
// J2SDK 1.4+; limited support by Oracle drivers 10.x and 9.x
pmd = cStmt.getParameterMetaData();
num = pmd.getParameterCount();
if (num >= 1) {
// oracle 10.1.0.4 has some stubs in ParameterMetaData,
// try if a function throws a UnsupportedFeature exception
pmd.getParameterType(1);
pmd.getParameterTypeName(1);
pmd.isNullable(1);
}
} catch (Exception e) {
pmd = null;
num = columns.size();
}
logcols = new ArrayList(num);
for (int i = 1; i <= num; i++) {
logcol = new JDBCLogColumn();
JDBCColumnStorage col = (JDBCColumnStorage) columns.get(i - 1);
logcol.name = col.column.toUpperCase();
if (pmd == null) {
logcol.type = col.type;
logcol.sqlType = col.sqlType;
logcol.nullable = true; // assume true
} else {
logcol.type = pmd.getParameterTypeName(i);
logcol.sqlType = pmd.getParameterType(i);
logcol.nullable = (pmd.isNullable(i) == ParameterMetaData.parameterNullable);
}
logcol.isWritable = true;
logcols.add(logcol);
}
cStmt.close();
freeConnection();
isconfigured = true;
}
示例3: isNullable
import java.sql.ParameterMetaData; //導入方法依賴的package包/類
@Override
public int isNullable(int param) throws SQLException {
return ParameterMetaData.parameterNullable;
}