Class ParameterMetaDataBase

java.lang.Object
org.tquadrat.foundation.sql.internal.ParameterMetaDataBase
All Implemented Interfaces:
ParameterMetaData
Direct Known Subclasses:
EnhancedPreparedStatementBase.ParameterMetaDataImpl

@ClassVersion(sourceVersion="$Id: ParameterMetaDataBase.java 1020 2022-02-27 21:26:03Z tquadrat $") @API(status=INTERNAL, since="0.1.0") public abstract sealed class ParameterMetaDataBase extends Object implements ParameterMetaData permits EnhancedPreparedStatementBase.ParameterMetaDataImpl
The base class for a variant of ParameterMetaData that is used by EnhancedPreparedStatement.
Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: ParameterMetaDataBase.java 1020 2022-02-27 21:26:03Z tquadrat $
Since:
0.1.0
UML Diagram
UML Diagram for "org.tquadrat.foundation.sql.internal.ParameterMetaDataBase"

UML Diagram for "org.tquadrat.foundation.sql.internal.ParameterMetaDataBase"

UML Diagram for "org.tquadrat.foundation.sql.internal.ParameterMetaDataBase"
  • Field Details

  • Constructor Details

  • Method Details

    • getParameterClassName

      public final String getParameterClassName(String parameterName) throws SQLException
      Retrieves the fully-qualified name of the Java class whose instances should be passed to the method EnhancedPreparedStatement.setObject(String, Object).
      Specified by:
      getParameterClassName in interface ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The fully-qualified name of the class in the Java programming language that would be used by the method EnhancedPreparedStatement.setObject() to set the value in the specified parameter. This is the class name used for custom mapping.
      Throws:
      SQLException - A database access error occurred.
    • getParameterCount

      public final int getParameterCount() throws SQLException
      Retrieves the number of parameters in the EnhancedPreparedStatement object for which this ParameterMetaData object contains information.
      Specified by:
      getParameterCount in interface ParameterMetaData
      Returns:
      The number of parameters.
      Throws:
      SQLException - A database access error occurred.
    • getParameterIndexes

      public abstract int[] getParameterIndexes(String parameterName) throws SQLException
      Retrieves the parameter indexes for the given parameter name.
      Specified by:
      getParameterIndexes in interface ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The parameter indexes for this parameter name.
      Throws:
      SQLException - The given parameter name is not defined.
    • getParameterNames

      public abstract Collection<String> getParameterNames()
      Retrieves the names of the parameters in the EnhancedPreparedStatement object for which this ParameterMetaData object contains information.
      Specified by:
      getParameterNames in interface ParameterMetaData
      Returns:
      The names of the parameters.
    • getParameterType

      public final SQLType getParameterType(String parameterName) throws SQLException

      Retrieves the designated parameter's SQL type.

      Different from ParameterMetaData.getParameterType(int) will this method return an instance of SQLType for the type, and not an integer.

      If the numerical value (as defined in Types) is required, it can be obtained like this:

        …
        int sqlType = getParameterType( param ).getVendorTypeNumber().intValue();
        …
      Specified by:
      getParameterType in interface ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The SQL type.
      Throws:
      SQLException - A database access error occurred.
      See Also:
    • getParameterTypeName

      public String getParameterTypeName(String parameterName) throws SQLException
      Retrieves the designated parameter's database-specific type name.
      Specified by:
      getParameterTypeName in interface ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The name of the type used by the database. If the parameter type is a user-defined type, then a fully-qualified type name is returned.
      Throws:
      SQLException - A database access error occurred.
    • getPrecision

      public final int getPrecision(String parameterName) throws 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 data types, 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 ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The precision.
      Throws:
      SQLException - A database access error occurred.
    • getScale

      public final int getScale(String parameterName) throws 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 ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The scale.
      Throws:
      SQLException - A database access error occurred.
    • isNullable

      public final int isNullable(String parameterName) throws SQLException

      Retrieves whether NULL values are allowed in the designated parameter.

      If the parameter with the the given name is used multiple times in the underlying PreparedStatement, this method returns 2 when the nullability status is not the same for all uses.

      Specified by:
      isNullable in interface ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      The nullability status of the given parameter; one of ParameterMetaData.parameterNoNulls, ParameterMetaData.parameterNullable, or ParameterMetaData.parameterNullableUnknown.
      Throws:
      SQLException - A database access error occurs
    • isSigned

      public boolean isSigned(String parameterName) throws SQLException
      Retrieves whether values for the designated parameter can be signed numbers.
      Specified by:
      isSigned in interface ParameterMetaData
      Parameters:
      parameterName - The name of the parameter, prefixed by a colon.
      Returns:
      true if a value can be a signed number, false otherwise.
      Throws:
      SQLException - A database access error occurred.