public class JDBCParameterMetaData extends Object implements ParameterMetaData, Wrapper
PreparedStatement object. (JDBC4 Clarification:) For some queries and driver
implementations, the data that would be returned by a ParameterMetaData
object may not be available until the PreparedStatement has
been executed.
Some driver implementations may not be able to provide information about the
types and properties for each parameter marker in a CallableStatement
object.
parameterModeIn, parameterModeInOut, parameterModeOut, parameterModeUnknown, parameterNoNulls, parameterNullable, parameterNullableUnknown| Modifier and Type | Method and Description |
|---|---|
String |
getParameterClassName(int param)
Retrieves the fully-qualified name of the Java class whose instances
should be passed to the method
PreparedStatement.setObject. |
int |
getParameterCount()
Retrieves the number of parameters in the
PreparedStatement
object for which this ParameterMetaData object contains
information. |
int |
getParameterMode(int param)
Retrieves the designated parameter's mode.
|
int |
getParameterType(int param)
Retrieves the designated parameter's SQL type.
|
String |
getParameterTypeName(int param)
Retrieves the designated parameter's database-specific type name.
|
int |
getPrecision(int param)
Retrieves the designated parameter's specified column size.
|
int |
getScale(int param)
Retrieves the designated parameter's number of digits to right of the decimal point.
|
int |
isNullable(int param)
Retrieves whether null values are allowed in the designated parameter.
|
boolean |
isSigned(int param)
Retrieves whether values for the designated parameter can be signed numbers.
|
boolean |
isWrapperFor(Class<?> iface)
Returns true if this either implements the interface argument or is directly or indirectly a wrapper
for an object that does.
|
String |
toString()
Retrieves a String representation of this object.
|
<T> T |
unwrap(Class<T> iface)
Returns an object that implements the given interface to allow access to
non-standard methods, or standard methods not exposed by the proxy.
|
public int getParameterCount()
throws SQLException
PreparedStatement
object for which this ParameterMetaData object contains
information.getParameterCount in interface ParameterMetaDataSQLException - if a database access error occurspublic int isNullable(int param)
throws SQLException
isNullable in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...ParameterMetaData.parameterNoNulls,
ParameterMetaData.parameterNullable, or
ParameterMetaData.parameterNullableUnknownSQLException - if a database access error occurspublic boolean isSigned(int param)
throws SQLException
isSigned in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...true if so; false otherwiseSQLException - if a database access error occurspublic int getPrecision(int param)
throws SQLException
The returned value represents the maximum column size for the given parameter. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. 0 is returned for data types where the column size is not applicable.
getPrecision in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...SQLException - if a database access error occurspublic int getScale(int param)
throws SQLException
getScale in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...SQLException - if a database access error occurspublic int getParameterType(int param)
throws SQLException
getParameterType in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...java.sql.TypesSQLException - if a database access error occursTypespublic String getParameterTypeName(int param) throws SQLException
getParameterTypeName in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...SQLException - if a database access error occurspublic String getParameterClassName(int param) throws SQLException
PreparedStatement.setObject.getParameterClassName in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...PreparedStatement.setObject to set the value
in the specified parameter. This is the class name used
for custom mapping.SQLException - if a database access error occurspublic int getParameterMode(int param)
throws SQLException
getParameterMode in interface ParameterMetaDataparam - the first parameter is 1, the second is 2, ...ParameterMetaData.parameterModeIn,
ParameterMetaData.parameterModeOut, or
ParameterMetaData.parameterModeInOut
ParameterMetaData.parameterModeUnknown.SQLException - if a database access error occurspublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap recursively on the wrapped object
or a proxy for that result. If the receiver is not a
wrapper and does not implement the interface, then an SQLException is thrown.unwrap in interface Wrapperiface - A Class defining an interface that the result must implement.SQLException - If no object found that implements the interfacepublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor on the wrapped
object. If this does not implement the interface and is not a wrapper, return false.
This method should be implemented as a low-cost operation compared to unwrap so that
callers can use this method to avoid expensive unwrap calls that may fail. If this method
returns true then calling unwrap with the same argument should succeed.isWrapperFor in interface Wrapperiface - a Class defining an interface.SQLException - if an error occurs while determining whether this is a wrapper
for an object with the given interface.Copyright © 2001 - 2017 HSQL Development Group.