Top Description Fields Constructors Methods
org.hsqldb.jdbc

public Class JDBCParameterMetaData

extends Object
implements ParameterMetaData, Wrapper
Class Inheritance
All Implemented Interfaces
java.sql.Wrapper, java.sql.ParameterMetaData
Imports
java.lang.reflect.Method, .Modifier, java.sql.ParameterMetaData, .SQLException, org.hsqldb.result.ResultMetaData, org.hsqldb.types.IntervalType, .Type

An object that can be used to get information about the types and properties for each parameter marker in a PreparedStatement object. 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.

Author
Campbell Burnet (campbell-burnet@users dot sourceforge.net)
Since
JDK 1.4, HSQLDB 1.7.2
Version
2.7.3

Field Summary

Modifier and TypeField and Description
pack-priv int
parameterCount

The number of parameters in the described statement

pack-priv ResultMetaData
rmd

The metadata object with which this object is constructed

private boolean

Constructor Summary

AccessConstructor and Description
pack-priv
JDBCParameterMetaData(JDBCConnection conn, ResultMetaData
A ResultMetaData object describing the statement parameters
metaData
)

Creates a new instance of JDBCParameterMetaData.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
checkRange(int
position to check
param
)

Checks if the value of the param argument is a valid parameter position.

public String

Returns:

the fully-qualified name of the class in the Java programming language that would be used by the method PreparedStatement.setObject to set the value in the specified parameter. This is the class name used for custom mapping.
getParameterClassName
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.getParameterClassName.

Retrieves the fully-qualified name of the Java class whose instances should be passed to the method PreparedStatement.setObject.

public int

Returns:

the number of parameters
getParameterCount
()

Implements java.sql.ParameterMetaData.getParameterCount.

Retrieves the number of parameters in the PreparedStatement object for which this ParameterMetaData object contains information.

public int

Returns:

mode of the parameter; one of ParameterMetaData.parameterModeIn, ParameterMetaData.parameterModeOut, or ParameterMetaData.parameterModeInOut ParameterMetaData.parameterModeUnknown.
getParameterMode
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.getParameterMode.

Retrieves the designated parameter's mode.

public int

Returns:

SQL type from java.sql.Types
getParameterType
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.getParameterType.

Retrieves the designated parameter's SQL type.

public String

Returns:

type the name used by the database. If the parameter type is a user-defined type, then a fully-qualified type name is returned.
getParameterTypeName
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.getParameterTypeName.

Retrieves the designated parameter's database-specific type name.

public int

Returns:

precision
getPrecision
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.getPrecision.

Retrieves the designated parameter's specified column size.

public int

Returns:

scale
getScale
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.getScale.

Retrieves the designated parameter's number of digits to right of the decimal point.

public int

Returns:

the nullability status of the given parameter; one of ParameterMetaData.parameterNoNulls, ParameterMetaData.parameterNullable, or ParameterMetaData.parameterNullableUnknown
isNullable
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.isNullable.

Retrieves whether null values are allowed in the designated parameter.

public boolean

Returns:

true if so; false otherwise
isSigned
(int
the first parameter is 1, the second is 2, ...
param
)

Implements java.sql.ParameterMetaData.isSigned.

Retrieves whether values for the designated parameter can be signed numbers.

public boolean

Returns:

true if this implements the interface or directly or indirectly wraps an object that does.
isWrapperFor
(Class<?>
a Class defining an interface.
iface
)

Implements java.sql.Wrapper.isWrapperFor.

Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.

public String

Returns:

a String representation of this object
toString
()

Overrides java.lang.Object.toString.

Retrieves a String representation of this object.

private String

Returns:

a String representation of this object
toStringImpl
()

Provides the implementation of the toString() method.

private Type
translateType(Type type)

Translates an INTERVAL type to VARCHAR.

public <T> T

Returns:

an object that implements the interface. May be a proxy for the actual implementing object.
unwrap
(Class<T>
A Class defining an interface that the result must implement.
iface
)

Implements java.sql.Wrapper.unwrap.

Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

parameterCountback to summary
pack-priv int parameterCount

The number of parameters in the described statement

rmdback to summary
pack-priv ResultMetaData rmd

The metadata object with which this object is constructed

translateTTITypeback to summary
private boolean translateTTIType

Constructor Detail

JDBCParameterMetaDataback to summary
pack-priv JDBCParameterMetaData(JDBCConnection conn, ResultMetaData metaData)

Creates a new instance of JDBCParameterMetaData.

Parameters
metaData:ResultMetaData

A ResultMetaData object describing the statement parameters

Method Detail

checkRangeback to summary
pack-priv void checkRange(int param) throws SQLException

Checks if the value of the param argument is a valid parameter position.

Parameters
param:int

position to check

Exceptions
SQLException:
if the value of the param argument is not a valid parameter position
getParameterClassNameback to summary
public String getParameterClassName(int param) throws SQLException

Implements java.sql.ParameterMetaData.getParameterClassName.

Retrieves the fully-qualified name of the Java class whose instances should be passed to the method PreparedStatement.setObject.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:String

the fully-qualified name of the class in the Java programming language that would be used by the method PreparedStatement.setObject to set the value in the specified parameter. This is the class name used for custom mapping.

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
getParameterCountback to summary
public int getParameterCount() throws SQLException

Implements java.sql.ParameterMetaData.getParameterCount.

Retrieves the number of parameters in the PreparedStatement object for which this ParameterMetaData object contains information.

Returns:int

the number of parameters

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
getParameterModeback to summary
public int getParameterMode(int param) throws SQLException

Implements java.sql.ParameterMetaData.getParameterMode.

Retrieves the designated parameter's mode.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:int

mode of the parameter; one of ParameterMetaData.parameterModeIn, ParameterMetaData.parameterModeOut, or ParameterMetaData.parameterModeInOut ParameterMetaData.parameterModeUnknown.

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
getParameterTypeback to summary
public int getParameterType(int param) throws SQLException

Implements java.sql.ParameterMetaData.getParameterType.

Retrieves the designated parameter's SQL type.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:int

SQL type from java.sql.Types

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
See Also
java.sql.Types
getParameterTypeNameback to summary
public String getParameterTypeName(int param) throws SQLException

Implements java.sql.ParameterMetaData.getParameterTypeName.

Retrieves the designated parameter's database-specific type name.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:String

type the name used by the database. If the parameter type is a user-defined type, then a fully-qualified type name is returned.

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
getPrecisionback to summary
public int getPrecision(int param) throws SQLException

Implements java.sql.ParameterMetaData.getPrecision.

Retrieves the designated parameter's specified column size.

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.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:int

precision

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
getScaleback to summary
public int getScale(int param) throws SQLException

Implements java.sql.ParameterMetaData.getScale.

Retrieves the designated parameter's number of digits to right of the decimal point. 0 is returned for data types where the scale is not applicable.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:int

scale

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
isNullableback to summary
public int isNullable(int param) throws SQLException

Implements java.sql.ParameterMetaData.isNullable.

Retrieves whether null values are allowed in the designated parameter.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:int

the nullability status of the given parameter; one of ParameterMetaData.parameterNoNulls, ParameterMetaData.parameterNullable, or ParameterMetaData.parameterNullableUnknown

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
isSignedback to summary
public boolean isSigned(int param) throws SQLException

Implements java.sql.ParameterMetaData.isSigned.

Retrieves whether values for the designated parameter can be signed numbers.

Parameters
param:int

the first parameter is 1, the second is 2, ...

Returns:boolean

true if so; false otherwise

Exceptions
SQLException:
if a database access error occurs
Since
JDK 1.4, HSQLDB 1.7.2
isWrapperForback to summary
public boolean isWrapperFor(Class<?> iface) throws SQLException

Implements java.sql.Wrapper.isWrapperFor.

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.

Parameters
iface:Class<?>

a Class defining an interface.

Returns:boolean

true if this implements the interface or directly or indirectly wraps an object that does.

Exceptions
SQLException:
if an error occurs while determining whether this is a wrapper for an object with the given interface.
Since
JDK 1.6, HSQLDB 2.0
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Retrieves a String representation of this object.

Returns:String

a String representation of this object

toStringImplback to summary
private String toStringImpl() throws Exception

Provides the implementation of the toString() method.

Returns:String

a String representation of this object

Exceptions
Exception:
if a reflection error occurs
translateTypeback to summary
private Type translateType(Type type)

Translates an INTERVAL type to VARCHAR. Removes time zone from datetime types.

unwrapback to summary
public <T> T unwrap(Class<T> iface) throws SQLException

Implements java.sql.Wrapper.unwrap.

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 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.

Parameters
iface:Class<T>

A Class defining an interface that the result must implement.

Returns:T

an object that implements the interface. May be a proxy for the actual implementing object.

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
If no object found that implements the interface
Since
JDK 1.6, HSQLDB 2.0