to top
Android APIs
public interface

ParameterMetaData

implements Wrapper
java.sql.ParameterMetaData

Class Overview

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.
[Expand]
Inherited Methods
From interface java.sql.Wrapper

Constants

public static final int parameterModeIn

Since: API Level 1

Indicates that the parameter mode is IN.

Constant Value: 1 (0x00000001)

public static final int parameterModeInOut

Since: API Level 1

Indicates that the parameter mode is INOUT.

Constant Value: 2 (0x00000002)

public static final int parameterModeOut

Since: API Level 1

Indicates that the parameter mode is OUT.

Constant Value: 4 (0x00000004)

public static final int parameterModeUnknown

Since: API Level 1

Indicates that the parameter mode is not known.

Constant Value: 0 (0x00000000)

public static final int parameterNoNulls

Since: API Level 1

Indicates that a parameter is not permitted to be NULL.

Constant Value: 0 (0x00000000)

public static final int parameterNullable

Since: API Level 1

Indicates that a parameter is permitted to be NULL.

Constant Value: 1 (0x00000001)

public static final int parameterNullableUnknown

Since: API Level 1

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

Constant Value: 2 (0x00000002)

Public Methods

public abstract String getParameterClassName (int paramIndex)

Since: API Level 1

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

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

public abstract int getParameterCount ()

Since: API Level 1

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

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

public abstract int getParameterMode (int paramIndex)

Since: API Level 1

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

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

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

public abstract int getParameterType (int paramIndex)

Since: API Level 1

Gets the SQL type of a specified parameter.

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

public abstract String getParameterTypeName (int paramIndex)

Since: API Level 1

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

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

public abstract int getPrecision (int paramIndex)

Since: API Level 1

Gets the number of decimal digits for a specified parameter.

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

public abstract int getScale (int paramIndex)

Since: API Level 1

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

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

public abstract int isNullable (int paramIndex)

Since: API Level 1

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

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

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

public abstract boolean isSigned (int paramIndex)

Since: API Level 1

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

Parameters
paramIndex the index number of the parameter, where the first parameter has index 1.
Returns
  • true if values can be signed numbers for this parameter, false otherwise.
Throws
SQLException if a database error happens.