public interface ParameterMetaData
ParameterMetaData provides information about the parameters of PreparedStatement and CallableStatement objects. The type of the parameter and various properties are available.
parameterNoNulls
public static final int parameterNoNulls
This is a constant for parameters that don’t allow NULL values.
parameterNullable
public static final int parameterNullable
This is a constant for parameters that allow NULL values.
parameterNullableUnknown
public static final int parameterNullableUnknown
This is a constant for parameters whose nullability isn’t known.
getParameterClassName
public String getParameterClassName(int param) throws SQLException
This gets the name of the Java class whose instances should be passed to the setObject() method of the PreparedStatement or CallableStatement.
Parameters:
param: | The parameter index begins at 1. |
Returns: The name of the Java class that will be used by the method PreparedStatement.setObject() or CallableStatement.setObject() to set the value in the specified parameter. This is the class name used for custom mapping. A SQLException is thrown if an error occurs while accessing this value.
getParameterCount
public int getParameterCount() throws SQLException
This returns the number of parameters for the PreparedStatement or CallableStatement to which the ParameterMetaData object belongs.
Returns: The number of parameters. A SQLException is thrown if an error occurs while accessing this value.
getParameterType
public int getParameterType(int param) throws SQLException
This gets the SQL type of the parameter.
Parameters:
param: | The parameter index begins at 1. |
Returns: The SQL type from java.sql.Types; a SQLException is thrown if an error occurs while accessing this value.
getParameterTypeName
public String getParameterTypeName(int param) throws SQLException
This gets the database-specific name for a parameter.
Parameters:
param: | The parameter index begins at 1. |
Returns: The database-specific type name. If the parameter type is a user-defined type, a fully qualified type name is returned. A SQLException is thrown if an error occurs while accessing this value.
getPrecision
public int getPrecision(int param) throws SQLException
This gets the number of decimal digits for the parameter.
Parameters:
param: | The parameter index begins at 1. |
Returns: The precision for this parameter. A SQLException is thrown if an error occurs while accessing this value.
getScale
public int getScale(int param) throws SQLException
This gets the number of digits to the right of the decimal point for the parameter.
Parameters:
param: | The parameter index begins at 1. |
Returns: The scale of the parameter. A SQLException is thrown if an error occurs while accessing this value.
isNullable
public int isNullable(int param) throws SQLException
This checks whether the parameter can be set to null.
Parameters:
param: | The parameter index begins at 1. |
Returns: The nullability for the given parameter, which is one of the following:
parameterNoNulls
parameterNullable
parameterNullableUnknown
A SQLException is thrown if an error occurs while accessing this value.
isSigned
public boolean isSigned(int param) throws SQLException
This checks whether the parameter value can be a signed number.
Parameters:
param: | The parameter index begins at 1. |
Returns: true if the parameter can be a signed number; false otherwise. A SQLException is thrown if an error occurs while accessing this value.