Skip to content

Most visited

Recently visited

navigation
Added in API level 1

ParameterMetaData

public interface ParameterMetaData
implements Wrapper

java.sql.ParameterMetaData


An interface used to get information about the types and properties of parameters in a PreparedStatement.

Summary

Constants

int parameterModeIn

Indicates that the parameter mode is IN.

int parameterModeInOut

Indicates that the parameter mode is INOUT.

int parameterModeOut

Indicates that the parameter mode is OUT.

int parameterModeUnknown

Indicates that the parameter mode is not known.

int parameterNoNulls

Indicates that a parameter is not permitted to be NULL.

int parameterNullable

Indicates that a parameter is permitted to be NULL.

int parameterNullableUnknown

Indicates that whether a parameter is allowed to be null or not is not known.

Public methods

abstract String getParameterClassName(int paramIndex)

Gets the fully-qualified name of the Java class which should be passed as a parameter to the method PreparedStatement.setObject.

abstract int getParameterCount()

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

abstract int getParameterMode(int paramIndex)

Gets the mode of the specified parameter.

abstract int getParameterType(int paramIndex)

Gets the SQL type of a specified parameter.

abstract String getParameterTypeName(int paramIndex)

Gets the database-specific type name of a specified parameter.

abstract int getPrecision(int paramIndex)

Gets the number of decimal digits for a specified parameter.

abstract int getScale(int paramIndex)

Gets the number of digits after the decimal point for a specified parameter.

abstract int isNullable(int paramIndex)

Gets whether null values are allowed for the specified parameter.

abstract boolean isSigned(int paramIndex)

Gets whether values for the specified parameter can be signed numbers.

Inherited methods

From interface java.sql.Wrapper

Constants

parameterModeIn

Added in API level 1
int parameterModeIn

Indicates that the parameter mode is IN.

Constant Value: 1 (0x00000001)

parameterModeInOut

Added in API level 1
int parameterModeInOut

Indicates that the parameter mode is INOUT.

Constant Value: 2 (0x00000002)

parameterModeOut

Added in API level 1
int parameterModeOut

Indicates that the parameter mode is OUT.

Constant Value: 4 (0x00000004)

parameterModeUnknown

Added in API level 1
int parameterModeUnknown

Indicates that the parameter mode is not known.

Constant Value: 0 (0x00000000)

parameterNoNulls

Added in API level 1
int parameterNoNulls

Indicates that a parameter is not permitted to be NULL.

Constant Value: 0 (0x00000000)

parameterNullable

Added in API level 1
int parameterNullable

Indicates that a parameter is permitted to be NULL.

Constant Value: 1 (0x00000001)

parameterNullableUnknown

Added in API level 1
int parameterNullableUnknown

Indicates that whether a parameter is allowed to be null or not is not known.

Constant Value: 2 (0x00000002)

Public methods

getParameterClassName

Added in API level 1
String getParameterClassName (int paramIndex)

Gets the fully-qualified name of the Java class which should be passed as a parameter to the method PreparedStatement.setObject.

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
String 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

Added in API level 1
int getParameterCount ()

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

Returns
int the number of parameters.
Throws
SQLException if a database error happens.

getParameterMode

Added in API level 1
int getParameterMode (int paramIndex)

Gets the mode of the specified parameter. Can be one of:

  • ParameterMetaData.parameterModeIn
  • ParameterMetaData.parameterModeOut
  • ParameterMetaData.parameterModeInOut
  • ParameterMetaData.parameterModeUnknown

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
int the parameter's mode.
Throws
SQLException if a database error happens.

getParameterType

Added in API level 1
int getParameterType (int paramIndex)

Gets the SQL type of a specified parameter.

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
int the SQL type of the parameter as defined in java.sql.Types.
Throws
SQLException if a database error happens.

getParameterTypeName

Added in API level 1
String getParameterTypeName (int paramIndex)

Gets the database-specific type name of a specified parameter.

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
String 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

Added in API level 1
int getPrecision (int paramIndex)

Gets the number of decimal digits for a specified parameter.

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
int the number of decimal digits ("the precision") for the parameter. 0 if the parameter is not a numeric type.
Throws
SQLException if a database error happens.

getScale

Added in API level 1
int getScale (int paramIndex)

Gets the number of digits after the decimal point for a specified parameter.

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
int the number of digits after the decimal point ("the scale") for the parameter. 0 if the parameter is not a numeric type.
Throws
SQLException if a database error happens.

isNullable

Added in API level 1
int isNullable (int paramIndex)

Gets whether null values are allowed for the specified parameter. The returned value is one of:

  • ParameterMetaData.parameterNoNulls
  • ParameterMetaData.parameterNullable
  • ParameterMetaData.parameterNullableUnknown

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
int the int code indicating the nullability of the parameter.
Throws
SQLException if a database error is encountered.

isSigned

Added in API level 1
boolean isSigned (int paramIndex)

Gets whether values for the specified parameter can be signed numbers.

Parameters
paramIndex int: the index number of the parameter, where the first parameter has index 1.
Returns
boolean true if values can be signed numbers for this parameter, false otherwise.
Throws
SQLException if a database error happens.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.