Package java.sql
Interface ParameterMetaData
-
-
Field Summary
Fields Modifier and Type Field Description static intparameterModeInIndicates that the parameter mode isIN.static intparameterModeInOutIndicates that the parameter mode isINOUT.static intparameterModeOutIndicates that the parameter mode isOUT.static intparameterModeUnknownIndicates that the parameter mode is not known.static intparameterNoNullsIndicates that a parameter is not permitted to beNULL.static intparameterNullableIndicates that a parameter is permitted to beNULL.static intparameterNullableUnknownIndicates that whether a parameter is allowed to benullor not is not known.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetParameterClassName(int paramIndex)Gets the fully-qualified name of the Java class which should be passed as a parameter to the methodPreparedStatement.setObject.intgetParameterCount()Gets the number of parameters in thePreparedStatementfor which thisParameterMetaDatacontains information.intgetParameterMode(int paramIndex)Gets the mode of the specified parameter.intgetParameterType(int paramIndex)Gets the SQL type of a specified parameter.StringgetParameterTypeName(int paramIndex)Gets the database-specific type name of a specified parameter.intgetPrecision(int paramIndex)Gets the number of decimal digits for a specified parameter.intgetScale(int paramIndex)Gets the number of digits after the decimal point for a specified parameter.intisNullable(int paramIndex)Gets whethernullvalues are allowed for the specified parameter.booleanisSigned(int paramIndex)Gets whether values for the specified parameter can be signed numbers.-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Field Detail
-
parameterModeIn
static final int parameterModeIn
Indicates that the parameter mode isIN.- See Also:
- Constant Field Values
-
parameterModeInOut
static final int parameterModeInOut
Indicates that the parameter mode isINOUT.- See Also:
- Constant Field Values
-
parameterModeOut
static final int parameterModeOut
Indicates that the parameter mode isOUT.- See Also:
- Constant Field Values
-
parameterModeUnknown
static final int parameterModeUnknown
Indicates that the parameter mode is not known.- See Also:
- Constant Field Values
-
parameterNoNulls
static final int parameterNoNulls
Indicates that a parameter is not permitted to beNULL.- See Also:
- Constant Field Values
-
parameterNullable
static final int parameterNullable
Indicates that a parameter is permitted to beNULL.- See Also:
- Constant Field Values
-
parameterNullableUnknown
static final int parameterNullableUnknown
Indicates that whether a parameter is allowed to benullor not is not known.- See Also:
- Constant Field Values
-
-
Method Detail
-
getParameterClassName
String getParameterClassName(int paramIndex) throws SQLException
Gets the fully-qualified name of the Java class which should be passed as a parameter to the methodPreparedStatement.setObject.- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the fully qualified Java class name of the parameter with the specified index. This class name is used for custom mapping between SQL types and Java objects.
- Throws:
SQLException- if a database error happens.
-
getParameterCount
int getParameterCount() throws SQLExceptionGets the number of parameters in thePreparedStatementfor which thisParameterMetaDatacontains information.- Returns:
- the number of parameters.
- Throws:
SQLException- if a database error happens.
-
getParameterMode
int getParameterMode(int paramIndex) throws SQLExceptionGets the mode of the specified parameter. Can be one of:- ParameterMetaData.parameterModeIn
- ParameterMetaData.parameterModeOut
- ParameterMetaData.parameterModeInOut
- ParameterMetaData.parameterModeUnknown
- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the parameter's mode.
- Throws:
SQLException- if a database error happens.
-
getParameterType
int getParameterType(int paramIndex) throws SQLExceptionGets the SQL type of a specified parameter.- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the SQL type of the parameter as defined in
java.sql.Types. - Throws:
SQLException- if a database error happens.
-
getParameterTypeName
String getParameterTypeName(int paramIndex) throws SQLException
Gets the database-specific type name of a specified parameter.- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the type name for the parameter as used by the database. A fully-qualified name is returned if the parameter is a User Defined Type (UDT).
- Throws:
SQLException- if a database error happens.
-
getPrecision
int getPrecision(int paramIndex) throws SQLExceptionGets the number of decimal digits for a specified parameter.- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the number of decimal digits ("the precision") for the parameter.
0if the parameter is not a numeric type. - Throws:
SQLException- if a database error happens.
-
getScale
int getScale(int paramIndex) throws SQLExceptionGets the number of digits after the decimal point for a specified parameter.- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the number of digits after the decimal point ("the scale") for
the parameter.
0if the parameter is not a numeric type. - Throws:
SQLException- if a database error happens.
-
isNullable
int isNullable(int paramIndex) throws SQLExceptionGets whethernullvalues are allowed for the specified parameter. The returned value is one of:- ParameterMetaData.parameterNoNulls
- ParameterMetaData.parameterNullable
- ParameterMetaData.parameterNullableUnknown
- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
- the int code indicating the nullability of the parameter.
- Throws:
SQLException- if a database error is encountered.
-
isSigned
boolean isSigned(int paramIndex) throws SQLExceptionGets whether values for the specified parameter can be signed numbers.- Parameters:
paramIndex- the index number of the parameter, where the first parameter has index 1.- Returns:
trueif values can be signed numbers for this parameter,falseotherwise.- Throws:
SQLException- if a database error happens.
-
-