org.firebirdsql.util

## Class FirebirdSupportInfo

- java.lang.Object
- - org.firebirdsql.util.FirebirdSupportInfo

-     public final class FirebirdSupportInfo
      extends java.lang.Object

  Helper class that reports if a Firebird version supports a specific feature.

  Intended as a repository for Jaybird to check for functionality support, or tests to check their assumptions, or decide on test or application behavior based on functionality support.

  Primary reason for existence of this class is to support version dependent functionality in Jaybird or version dependent tests in the Jaybird test suite, so feature checks are only added when they are necessary for Jaybird or the test suite. That said: if you miss feature checks, don't hesitate to create an issue in the Jaybird tracker.

  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isVersionBelow(int majorVersion, int minorVersion)` Check if the major.minor of this version is below the specified version.
    `boolean` | `isVersionEqualOrAbove(int majorVersion, int minorVersion)` Check if the major.minor of this version is equal to or larger than the specified version.
    `int` | `maxIdentifierLengthBytes()`
    `int` | `maxIdentifierLengthCharacters()`
    `int` | `maxReportedIdentifierLengthBytes()`
    `int` | `reportedMetadataCharacterSetId()`
    `boolean` | `reportsBlobCharSetInDescriptor()`
    `boolean` | `reportsByteLengthInDescriptor()` TODO: Check if this is for all types or only for metadata.
    `static FirebirdSupportInfo` | `supportInfoFor(java.sql.Connection connection)`
    `static FirebirdSupportInfo` | `supportInfoFor(FbAttachment attachment)`
    `static FirebirdSupportInfo` | `supportInfoFor(GDSServerVersion serverVersion)`
    `boolean` | `supportsBigint()` Checks if BIGINT is supported.
    `boolean` | `supportsBoolean()`
    `boolean` | `supportsCancelOperation()`
    `boolean` | `supportsCase()`
    `boolean` | `supportsCaseSensitiveUserNames()`
    `boolean` | `supportsComment()`
    `boolean` | `supportsCustomExceptionMessages()`
    `boolean` | `supportsExecuteBlock()`
    `boolean` | `supportsFullSearchableBlobs()`
    `boolean` | `supportsGetSetContext()`
    `boolean` | `supportsGlobalTemporaryTables()`
    `boolean` | `supportsIdentityColumns()`
    `boolean` | `supportsInsertReturning()` TODO: Add methods for other RETURNING types?
    `boolean` | `supportsMonitoringTables()`
    `boolean` | `supportsNativeUserDefinedFunctions()`
    `boolean` | `supportsNullDataType()`
    `boolean` | `supportsPageSize(int pageSize)`
    `boolean` | `supportsParametrizedExceptions()`
    `boolean` | `supportsProtocol(int protocolVersion)` Checks support for protocol versions.
    `boolean` | `supportsSavepoint()`
    `boolean` | `supportsSqlUserManagement()`
    `boolean` | `supportsTableAlias()`
    `boolean` | `supportsUpdateReturning()`
    `boolean` | `supportsUserAndGroupIdInUser()`
    `boolean` | `supportsUtf8()`
    `boolean` | `supportsWireEncryption()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isVersionEqualOrAbove

          public boolean isVersionEqualOrAbove(int majorVersion,
                                               int minorVersion)

      Check if the major.minor of this version is equal to or larger than the specified version.
      Parameters:
        `majorVersion` - Major version
        `minorVersion` - Minor version
      Returns:
        `true` when current major is larger than required, or major is same and minor is equal to or larger than required

    - #### isVersionBelow

          public boolean isVersionBelow(int majorVersion,
                                        int minorVersion)

      Check if the major.minor of this version is below the specified version.

      Equivalent to `!isVersionEqualOrAbove(majorVersion, minorVersion)`.

      Parameters:
        `majorVersion` - Major version
        `minorVersion` - Minor version
      Returns:
        `true` when current major is smaller than the specified major, or major is same and minor is smaller than the specified minor

    - #### supportsBigint

          public boolean supportsBigint()

      Checks if BIGINT is supported.

      Low level this feature was added in Interbase 6.0 / Firebird 1.0, but it was never surfaced in DDL

      Returns:
        `true` when the data type BIGINT is supported

    - #### supportsBoolean

          public boolean supportsBoolean()

      Returns:
        `true` when the data type BOOLEAN is supported

    - #### supportsComment

          public boolean supportsComment()

      Returns:
        `true` when the COMMENT statement is supported

    - #### supportsGetSetContext

          public boolean supportsGetSetContext()

      Returns:
        `true` when RDB$GET_CONTEXT and RDB$SET_CONTEXT are supported

    - #### supportsCase

          public boolean supportsCase()

      Returns:
        `true` when CASE (simple or searched) is supported

    - #### reportsBlobCharSetInDescriptor

          public boolean reportsBlobCharSetInDescriptor()

      Returns:
        `true` when the blob character set is reported in the scale of the field descriptor

    - #### reportsByteLengthInDescriptor

          public boolean reportsByteLengthInDescriptor()

      TODO: Check if this is for all types or only for metadata.
      Returns:
        `true` when the length of the field descriptor reports the byte length (max byte per char * char length)

    - #### supportsInsertReturning

          public boolean supportsInsertReturning()

      TODO: Add methods for other RETURNING types?
      Returns:
        `true` when INSERT ... RETURNING ... is supported

    - #### supportsUpdateReturning

          public boolean supportsUpdateReturning()

      Returns:
        `true` when UPDATE ... RETURNING ... is supported

    - #### supportsUtf8

          public boolean supportsUtf8()

      Returns:
        `true` when the server knows the UTF8 character set (NOTE: For firebird 1.5 it is an alias for UNICODE_FSS)

    - #### supportsSavepoint

          public boolean supportsSavepoint()

      Returns:
        `true` when SAVEPOINT is supported

    - #### supportsExecuteBlock

          public boolean supportsExecuteBlock()

      Returns:
        `true` when EXECUTE BLOCK is supported

    - #### supportsSqlUserManagement

          public boolean supportsSqlUserManagement()

      Returns:
        `true` when CREATE/ALTER/DROP USER is supported

    - #### supportsCancelOperation

          public boolean supportsCancelOperation()

      Returns:
        `true` when fb_cancel_operation is supported

    - #### supportsTableAlias

          public boolean supportsTableAlias()

      Returns:
        `true` when field descriptors contain table alias information

    - #### supportsNullDataType

          public boolean supportsNullDataType()

      Returns:
        `true` when the `NULL` data type and `? IS NULL` is supported

    - #### supportsUserAndGroupIdInUser

          public boolean supportsUserAndGroupIdInUser()

      Returns:
        `true` when `isc_spb_sec_userid` and `isc_spb_sec_groupid` are supported.

    - #### supportsProtocol

          public boolean supportsProtocol(int protocolVersion)

      Checks support for protocol versions. The check is limited to those protocol versions supported by Jaybird (10-13 at this time).
      Parameters:
        `protocolVersion` - Protocol version number
      Returns:
        `true` when the database supports the specified protocol

    - #### supportsCustomExceptionMessages

          public boolean supportsCustomExceptionMessages()

      Returns:
        `true` when custom exception messages are supported.

    - #### supportsParametrizedExceptions

          public boolean supportsParametrizedExceptions()

      Returns:
        `true` when parametrized exceptions are supported.

    - #### supportsMonitoringTables

          public boolean supportsMonitoringTables()

      Returns:
        `true` when monitoring tables are supported.

    - #### supportsGlobalTemporaryTables

          public boolean supportsGlobalTemporaryTables()

      Returns:
        `true` when global temporary tables (GTTs) are supported.

    - #### supportsFullSearchableBlobs

          public boolean supportsFullSearchableBlobs()

      Returns:
        `true` when blobs are fully searchable (eg using `LIKE`).

    - #### supportsIdentityColumns

          public boolean supportsIdentityColumns()

      Returns:
        `true` when identity columns are supported.

    - #### maxIdentifierLengthCharacters

          public int maxIdentifierLengthCharacters()

      Returns:
        The maximum number of characters in an identifier.

    - #### maxIdentifierLengthBytes

          public int maxIdentifierLengthBytes()

      Returns:
        The maximum number of bytes in an identifier.
      See Also:
        `maxReportedIdentifierLengthBytes()`

    - #### maxReportedIdentifierLengthBytes

          public int maxReportedIdentifierLengthBytes()

      Returns:
        The maximum number of bytes reported in parameter metadata for an identifier
      See Also:
        `maxIdentifierLengthBytes()`

    - #### reportedMetadataCharacterSetId

          public int reportedMetadataCharacterSetId()

      Returns:
        The character set id of system metadata

    - #### supportsPageSize

          public boolean supportsPageSize(int pageSize)

    - #### supportsWireEncryption

          public boolean supportsWireEncryption()

    - #### supportsNativeUserDefinedFunctions

          public boolean supportsNativeUserDefinedFunctions()

      Returns:
        `true` when UDFs (User Defined Functions) - backed by a native library - are supported

    - #### supportsCaseSensitiveUserNames

          public boolean supportsCaseSensitiveUserNames()

      Returns:
        `true` when this Firebird version supports case sensitive user names.

    - #### supportInfoFor

          public static FirebirdSupportInfo supportInfoFor(GDSServerVersion serverVersion)

      Parameters:
        `serverVersion` - Server version
      Returns:
        FirebirdVersionSupport instance

    - #### supportInfoFor

          public static FirebirdSupportInfo supportInfoFor(FbAttachment attachment)

      Parameters:
        `attachment` - Low level attachment object
      Returns:
        FirebirdVersionSupport instance

    - #### supportInfoFor

          public static FirebirdSupportInfo supportInfoFor(java.sql.Connection connection)

      Parameters:
        `connection` - A database connection (NOTE: `Connection` is used, but it must be or unwrap to a `FirebirdConnection`.
      Returns:
        FirebirdVersionSupport instance
      Throws:
        `java.lang.IllegalArgumentException` - When the provided connection is not an instance of or wrapper for `FirebirdConnection`
        `java.lang.IllegalStateException` - When an SQLException occurs unwrapping the connection, or creating the `FirebirdSupportInfo` instance

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.