org.hsqldb.jdbc

## Class JDBCParameterMetaData

- java.lang.Object
- - org.hsqldb.jdbc.JDBCParameterMetaData

- All Implemented Interfaces:
    java.sql.ParameterMetaData, java.sql.Wrapper

      public class JDBCParameterMetaData
      extends java.lang.Object
      implements java.sql.ParameterMetaData, java.sql.Wrapper

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

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

- - ### Field Summary

    - ### Fields inherited from interface java.sql.ParameterMetaData

      `parameterModeIn, parameterModeInOut, parameterModeOut, parameterModeUnknown, parameterNoNulls, parameterNullable, parameterNullableUnknown`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getParameterClassName(int param)` Retrieves the fully-qualified name of the Java class whose instances should be passed to the method `PreparedStatement.setObject`.
    `int` | `getParameterCount()` Retrieves the number of parameters in the `PreparedStatement` object for which this `ParameterMetaData` object contains information.
    `int` | `getParameterMode(int param)` Retrieves the designated parameter's mode.
    `int` | `getParameterType(int param)` Retrieves the designated parameter's SQL type.
    `java.lang.String` | `getParameterTypeName(int param)` Retrieves the designated parameter's database-specific type name.
    `int` | `getPrecision(int param)` Retrieves the designated parameter's specified column size.
    `int` | `getScale(int param)` Retrieves the designated parameter's number of digits to right of the decimal point.
    `int` | `isNullable(int param)` Retrieves whether null values are allowed in the designated parameter.
    `boolean` | `isSigned(int param)` Retrieves whether values for the designated parameter can be signed numbers.
    `boolean` | `isWrapperFor(java.lang.Class<?> iface)` Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.
    `java.lang.String` | `toString()` Retrieves a String representation of this object.
    `<T> T` | `unwrap(java.lang.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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getParameterCount

          public int getParameterCount()
                                throws java.sql.SQLException

      Retrieves the number of parameters in the `PreparedStatement` object for which this `ParameterMetaData` object contains information.
      Specified by:
        `getParameterCount` in interface `java.sql.ParameterMetaData`
      Returns:
        the number of parameters
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### isNullable

          public int isNullable(int param)
                         throws java.sql.SQLException

      Retrieves whether null values are allowed in the designated parameter.
      Specified by:
        `isNullable` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      Returns:
        the nullability status of the given parameter; one of `ParameterMetaData.parameterNoNulls`, `ParameterMetaData.parameterNullable`, or `ParameterMetaData.parameterNullableUnknown`
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### isSigned

          public boolean isSigned(int param)
                           throws java.sql.SQLException

      Retrieves whether values for the designated parameter can be signed numbers.
      Specified by:
        `isSigned` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      Returns:
        `true` if so; `false` otherwise
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### getPrecision

          public int getPrecision(int param)
                           throws java.sql.SQLException

      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.

      Specified by:
        `getPrecision` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      Returns:
        precision
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### getScale

          public int getScale(int param)
                       throws java.sql.SQLException

      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.
      Specified by:
        `getScale` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      Returns:
        scale
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### getParameterType

          public int getParameterType(int param)
                               throws java.sql.SQLException

      Retrieves the designated parameter's SQL type.
      Specified by:
        `getParameterType` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      Returns:
        SQL type from `java.sql.Types`
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2
      See Also:
        `Types`

    - #### getParameterTypeName

          public java.lang.String getParameterTypeName(int param)
                                                throws java.sql.SQLException

      Retrieves the designated parameter's database-specific type name.
      Specified by:
        `getParameterTypeName` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      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.
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### getParameterClassName

          public java.lang.String getParameterClassName(int param)
                                                 throws java.sql.SQLException

      Retrieves the fully-qualified name of the Java class whose instances should be passed to the method `PreparedStatement.setObject`.
      Specified by:
        `getParameterClassName` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      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.
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### getParameterMode

          public int getParameterMode(int param)
                               throws java.sql.SQLException

      Retrieves the designated parameter's mode.
      Specified by:
        `getParameterMode` in interface `java.sql.ParameterMetaData`
      Parameters:
        `param` - the first parameter is 1, the second is 2, ...
      Returns:
        mode of the parameter; one of `ParameterMetaData.parameterModeIn`, `ParameterMetaData.parameterModeOut`, or `ParameterMetaData.parameterModeInOut` `ParameterMetaData.parameterModeUnknown`.
      Throws:
        `java.sql.SQLException` - if a database access error occurs
      Since:
        JDK 1.4, HSQLDB 1.7.2

    - #### unwrap

          public <T> T unwrap(java.lang.Class<T> iface)
                       throws java.sql.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 `java.sql.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:
        `java.sql.SQLException` - If no object found that implements the interface
      Since:
        JDK 1.6, HSQLDB 2.0

    - #### isWrapperFor

          public boolean isWrapperFor(java.lang.Class<?> iface)
                               throws java.sql.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 `java.sql.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:
        `java.sql.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

    - #### toString

          public java.lang.String toString()

      Retrieves a String representation of this object.

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a String representation of this object

Copyright © 2001 - 2018 HSQL Development Group.