Android
java.sql
public interface

java.sql.ParameterMetaData

java.sql.ParameterMetaData

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

Summary

Constants

      Value  
int  parameterModeIn  Indicates that the parameter mode is IN.  0x00000001 
int  parameterModeInOut  Indicates that the parameter mode is INOUT.  0x00000002 
int  parameterModeOut  Indicates that the parameter mode is OUT.  0x00000004 
int  parameterModeUnknown  Indicates that the parameter mode is not known.  0x00000000 
int  parameterNoNulls  Indicates that a parameter is not permitted to be NULL.  0x00000000 
int  parameterNullable  Indicates that a parameter is permitted to be NULL.  0x00000001 
int  parameterNullableUnknown  Indicates that whether a parameter is allowed to be null or not is not known.  0x00000002 

Public Methods

          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.
          int  getParameterCount()
Gets the number of parameters in the PreparedStatement for which this ParameterMetaData contains information.
          int  getParameterMode(int paramIndex)
Gets the mode of the specified parameter.
          int  getParameterType(int paramIndex)
Gets the SQL type of a specified parameter.
          String  getParameterTypeName(int paramIndex)
Gets the database-specific type name of a specified parameter.
          int  getPrecision(int paramIndex)
Gets the number of decimal digits for a specified parameter.
          int  getScale(int paramIndex)
Gets the number of digits after the decimal point for a specified parameter.
          int  isNullable(int paramIndex)
Gets whether null values are allowed for the specified parameter.
          boolean  isSigned(int paramIndex)
Gets whether values for the specified parameter can be signed numbers.

Details

Constants

public static final int parameterModeIn

Indicates that the parameter mode is IN.
Constant Value: 1 (0x00000001)

public static final int parameterModeInOut

Indicates that the parameter mode is INOUT.
Constant Value: 2 (0x00000002)

public static final int parameterModeOut

Indicates that the parameter mode is OUT.
Constant Value: 4 (0x00000004)

public static final int parameterModeUnknown

Indicates that the parameter mode is not known.
Constant Value: 0 (0x00000000)

public static final int parameterNoNulls

Indicates that a parameter is not permitted to be NULL.
Constant Value: 0 (0x00000000)

public static final int parameterNullable

Indicates that a parameter is permitted to be NULL.
Constant Value: 1 (0x00000001)

public static final int parameterNullableUnknown

Indicates that whether a parameter is allowed to be null or not is not known.
Constant Value: 2 (0x00000002)

Public Methods

public 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 the index number of the parameter, where the first parameter has an index of 1

Returns

  • a String with the fully qualified Java class name of the parameter with the specified index. This class name is used for custom mapping.

Throws

SQLException if a database error happens

public int getParameterCount()

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

Returns

  • the number of parameters as an int

Throws

SQLException if a database error happens

public int getParameterMode(int paramIndex)

Gets the mode of the specified parameter.

Parameters

paramIndex the index number of the parameter, where the first parameter has an index of 1

Returns

  • the parameters mode. Can be: ParameterMetaData.parameterModeIn, ParameterMetaData.parameterModeOut, ParameterMetaData.parameterModeInOut or ParameterMetaData.parameterModeUnknown.

Throws

SQLException if a database error happens

public int getParameterType(int paramIndex)

Gets the SQL type of a specified parameter.

Parameters

paramIndex the index number of the parameter, where the first parameter has an index of 1

Returns

  • the type of the parameter - an SQL type as defined in java.sql.Types.

Throws

SQLException if a database error happens

public String getParameterTypeName(int paramIndex)

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

Parameters

paramIndex the index number of the parameter, where the first parameter has an index of 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.

Throws

SQLException if a database error happens

public int getPrecision(int paramIndex)

Gets the number of decimal digits for a specified parameter.

Parameters

paramIndex the index number of the parameter, where the first parameter has an index of 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 int getScale(int paramIndex)

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 an index of 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 int isNullable(int paramIndex)

Gets whether null values are allowed for the specified parameter.

Parameters

paramIndex the index number of the parameter, where the first parameter has an index of 1

Returns

  • indicator of nullability, can be: ParameterMetaData.parameterNoNulls, ParameterMetaData.parameterNullable, or ParameterMetaData.parameterNullableUnknown

Throws

SQLException if a database error is encountered

public boolean isSigned(int paramIndex)

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

Parameters

paramIndex the index number of the parameter, where the first parameter has an index of 1

Returns

  • true if values can be signed numbers for this parameter, false otherwise.

Throws

SQLException if a database error happens
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56