com.ibm.as400.access
Class AS400JDBCParameterMetaData

java.lang.Object
  extended by com.ibm.as400.access.AS400JDBCParameterMetaData
All Implemented Interfaces:
ParameterMetaData, Wrapper

public class AS400JDBCParameterMetaData
extends Object
implements ParameterMetaData

The AS400JDBCParameterMetaData class can be used to retrieve information about the parameters of a PreparedStatement. Use PreparedStatement.getParameterMetaData() to create new ParameterMetaData objects.


Field Summary
 
Fields inherited from interface java.sql.ParameterMetaData
parameterModeIn, parameterModeInOut, parameterModeOut, parameterModeUnknown, parameterNoNulls, parameterNullable, parameterNullableUnknown
 
Method Summary
 String getParameterClassName(int parameterIndex)
          Returns the fully-qualified name of the Java class of the specified parameter.
 int getParameterCount()
          Returns the number of parameters in this ParameterMetaData object.
 int getParameterMode(int parameterIndex)
          Returns the mode of the specified parameter or if that information is unknown.
 int getParameterType(int parameterIndex)
          Returns the SQL type of the specified parameter.
 String getParameterTypeName(int parameterIndex)
          Returns the database-specific type name of the specified parameter.
 int getPrecision(int parameterIndex)
          Returns the number of decimal digits of the specified parameter.
 int getScale(int parameterIndex)
          Returns the number of digits to the right of the decimal point of the specified parameter.
protected  String[] getValidWrappedList()
           
 int isNullable(int parameterIndex)
          Returns if the specified parameter can be null or that information is unknown.
 boolean isSigned(int parameterIndex)
          Returns if values can be signed numbers for the specified parameter.
 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.
<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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Method Detail

getParameterClassName

public String getParameterClassName(int parameterIndex)
                             throws SQLException
Returns the fully-qualified name of the Java class of the specified parameter.

Specified by:
getParameterClassName in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The fully-qualified name of the Java class.
Throws:
SQLException - If the prepared statement is not open.

getParameterCount

public int getParameterCount()
                      throws SQLException
Returns the number of parameters in this ParameterMetaData object.

Specified by:
getParameterCount in interface ParameterMetaData
Returns:
The number of parameters in the ParameterMetaData object.
Throws:
SQLException - If the prepared statement is not open.

getParameterMode

public int getParameterMode(int parameterIndex)
                     throws SQLException
Returns the mode of the specified parameter or if that information is unknown.

Specified by:
getParameterMode in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The mode of the parameter. Valid values are ParameterMetaData.parameterModeIn, ParameterMetaData.parameterModeOut, ParameterMetaData.parameterModeInOut, and ParameterMetaData.parameterModeUnknown.
Throws:
SQLException - If the prepared statement is not open.

getParameterType

public int getParameterType(int parameterIndex)
                     throws SQLException
Returns the SQL type of the specified parameter.

Specified by:
getParameterType in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The SQL type of the parameter.
Throws:
SQLException - If the prepared statement is not open.

getParameterTypeName

public String getParameterTypeName(int parameterIndex)
                            throws SQLException
Returns the database-specific type name of the specified parameter.

Specified by:
getParameterTypeName in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The type name of the parameter.
Throws:
SQLException - If the prepared statement is not open.

getPrecision

public int getPrecision(int parameterIndex)
                 throws SQLException
Returns the number of decimal digits of the specified parameter.

Specified by:
getPrecision in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The precision of the parameter.
Throws:
SQLException - If the prepared statement is not open.

getScale

public int getScale(int parameterIndex)
             throws SQLException
Returns the number of digits to the right of the decimal point of the specified parameter.

Specified by:
getScale in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
The scale of the parameter.
Throws:
SQLException - If the prepared statement is not open.

isNullable

public int isNullable(int parameterIndex)
               throws SQLException
Returns if the specified parameter can be null or that information is unknown.

Specified by:
isNullable in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
Returns if the parameter can be null. The valid values are ParameterMetaData.parameterNoNulls, ParameterMetaData.parameterNullable, and ParameterMetaData.parameterNullableUnknown.
Throws:
SQLException - If the prepared statement is not open.

isSigned

public boolean isSigned(int parameterIndex)
                 throws SQLException
Returns if values can be signed numbers for the specified parameter.

Specified by:
isSigned in interface ParameterMetaData
Parameters:
parameterIndex - The parameter index (1-based).
Returns:
Returns true if values for the specified parameter can be signed numbers, false otherwise.
Throws:
SQLException - If the prepared statement is not open.

getValidWrappedList

protected String[] getValidWrappedList()

isWrapperFor

public boolean isWrapperFor(Class<?> iface)
                     throws SQLException
Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. Returns false otherwise. If this implements the interface then return true, else if this is a wrapper then return the result of recursively calling 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.

Specified by:
isWrapperFor in interface Wrapper
Parameters:
iface - a Class defining an interface.
Returns:
true if this implements the interface or directly or indirectly wraps an object that does.
Throws:
SQLException - if an error occurs while determining whether this is a wrapper for an object with the given interface.

unwrap

public <T> T unwrap(Class<T> iface)
         throws SQLException
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling 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.

Specified by:
unwrap in interface Wrapper
Parameters:
iface - A Class defining an interface that the result must implement.
Returns:
an object that implements the interface. May be a proxy for the actual implementing object.
Throws:
SQLException - If no object found that implements the interface