Module org.firebirdsql.jaybird
Package org.firebirdsql.util

# Class FirebirdSupportInfo

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

public final class FirebirdSupportInfo extends 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

  Modifier and Type
  Method
  Description
  `OdsVersion`
  `getDefaultOdsVersion()`
  `int`
  `getSystemTableCount()`
  The number of system tables (including monitoring tables).
  `boolean`
  `hasProcedureTypeColumn()`
  `boolean`
  `isSupportedVersion()`
  `boolean`
  `isVersionBelow(int majorVersion)`
  Check if the major of this version is below the specified version.
  `boolean`
  `isVersionBelow(int majorVersion, int minorVersion)`
  Check if the major.minor of this version is below the specified version.
  `boolean`
  `isVersionEqualOrAbove(int majorVersion)`
  Check if the major of this version is equal to or larger than 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.
  `boolean`
  `isVersionEqualOrAbove(int requiredMajorVersion, int requiredMinorVersion, int requiredVariant)`
  Check if the major.minor.variant of this version is equal to or larger than the specified required version.
  `boolean`
  `isWindows()`
  `int`
  `maxDecimalPrecision()`
  `int`
  `maxIdentifierLengthBytes()`
  `int`
  `maxIdentifierLengthCharacters()`
  `int`
  `maxReportedIdentifierLengthBytes()`
  `int`
  `reportedMetadataCharacterSetId()`
  `boolean`
  `reportsBlobCharSetInDescriptor()`
  `boolean`
  `reportsByteLengthInDescriptor()`
  `static FirebirdSupportInfo`
  `supportInfoFor(Connection connection)`
  `static FirebirdSupportInfo`
  `supportInfoFor(GDSServerVersion serverVersion)`
  `static FirebirdSupportInfo`
  `supportInfoFor(FbAttachment attachment)`
  `boolean`
  `supportsAuthenticationPlugin(String pluginName)`
  Checks whether the Firebird version supports a plugin name.
  `boolean`
  `supportsBigint()`
  Checks if BIGINT is supported.
  `boolean`
  `supportsBoolean()`
  `boolean`
  `supportsCancelOperation()`
  `boolean`
  `supportsCase()`
  `boolean`
  `supportsCaseSensitiveUserNames()`
  `boolean`
  `supportsComment()`
  `boolean`
  `supportsCustomExceptionMessages()`
  `boolean`
  `supportsCustomSecurityDb()`
  `boolean`
  `supportsDatabaseTriggers()`
  `boolean`
  `supportsDecfloat()`
  `boolean`
  `supportsDecimalPrecision(int precision)`
  Support for decimal (and numeric) precision.
  `boolean`
  `supportsExecuteBlock()`
  `boolean`
  `supportsExplainedExecutionPlan()`
  `boolean`
  `supportsFixIcu()`
  `boolean`
  `supportsFloatBinaryPrecision()`
  `boolean`
  `supportsFullSearchableBlobs()`
  `boolean`
  `supportsGetSetContext()`
  `boolean`
  `supportsGlobalTemporaryTables()`
  `boolean`
  `supportsIdentityColumns()`
  `boolean`
  `supportsInlineBlobs()`
  Reports if inline blobs are supported.
  `boolean`
  `supportsInsertReturning()`
  TODO: Add methods for other RETURNING types?
  `boolean`
  `supportsInt128()`
  `boolean`
  `supportsLegacyMultiFileDatabase()`
  `boolean`
  `supportsMetadataPrivileges()`
  `boolean`
  `supportsMonitoringTables()`
  `boolean`
  `supportsMultiRowReturning()`
  `boolean`
  `supportsNamelessServiceManager()`
  `boolean`
  `supportsNativeUserDefinedFunctions()`
  `boolean`
  `supportsNBackupCleanHistory()`
  `boolean`
  `supportsNBackupFixup()`
  `boolean`
  `supportsNBackupInPlaceRestore()`
  `boolean`
  `supportsNBackupPreserveSequence()`
  `boolean`
  `supportsNBackupWithGuid()`
  `boolean`
  `supportsNullDataType()`
  `boolean`
  `supportsOds(int major, int minor)`
  Reports if the specified ODS version is supported.
  `boolean`
  `supportsOds(OdsVersion odsVersion)`
  Reports if the specified ODS version is supported.
  `boolean`
  `supportsPackages()`
  `boolean`
  `supportsPageSize(int pageSize)`
  `boolean`
  `supportsParallelWorkers()`
  `boolean`
  `supportsParameterizedExceptions()`
  `boolean`
  `supportsParametrizedExceptions()`
  `boolean`
  `supportsPartialIndices()`
  `boolean`
  `supportsProtocol(int protocolVersion)`
  Checks support for protocol versions.
  `boolean`
  `supportsPsqlFunctions()`
  `boolean`
  `supportsRDB$CONFIG()`
  `boolean`
  `supportsRecordVersionPseudoColumn()`
  `boolean`
  `supportsReturningAll()`
  `boolean`
  `supportsSavepoint()`
  `boolean`
  `supportsScrollableCursors()`
  `boolean`
  `supportsServerBatch()`
  `boolean`
  `supportsSqlUserManagement()`
  `boolean`
  `supportsStatementTextLongerThan64K()`
  `boolean`
  `supportsStatementTimeouts()`
  `boolean`
  `supportsStatementUnprepare()`
  `boolean`
  `supportsTableAlias()`
  `boolean`
  `supportsTimeZones()`
  `boolean`
  `supportsUpdateReturning()`
  `boolean`
  `supportsUpgradeOds()`
  `boolean`
  `supportsUserAndGroupIdInUser()`
  `boolean`
  `supportsUtf8()`
  `boolean`
  `supportsWireCompression()`
  `boolean`
  `supportsWireCryptArc4()`
  `boolean`
  `supportsWireCryptChaCha()`
  `boolean`
  `supportsWireCryptChaCha64()`
  `boolean`
  `supportsWireEncryption()`
  `boolean`
  `supportsWnet()`

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

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

- ## Method Details

  - ### isVersionEqualOrAbove

    public boolean isVersionEqualOrAbove(int majorVersion)
    Check if the major of this version is equal to or larger than the specified version.
    Parameters:
      `majorVersion` - Major version
    Returns:
      `true` when current major is equal to or larger than required

  - ### 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

  - ### isVersionEqualOrAbove

    public boolean isVersionEqualOrAbove(int requiredMajorVersion, int requiredMinorVersion, int requiredVariant)
    Check if the major.minor.variant of this version is equal to or larger than the specified required version.
    Parameters:
      `requiredMajorVersion` - Required major version
      `requiredMinorVersion` - Required minor version
      `requiredVariant` - Required variant version
    Returns:
      `true` when current major is larger than required, or major is same and minor is equal to required and variant equal to or larger than required, or major is same and minor is 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

  - ### isVersionBelow

    public boolean isVersionBelow(int majorVersion)
    Check if the major of this version is below the specified version.

    Equivalent to `!isVersionEqualOrAbove(majorVersion)`.

    Parameters:
      `majorVersion` - Major version
    Returns:
      `true` when current major is smaller than the specified major

  - ### 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

  - ### supportsDecfloat

    public boolean supportsDecfloat()
    Returns:
      `true` when the data type DECFLOAT is supported

  - ### supportsDecimalPrecision

    public boolean supportsDecimalPrecision(int precision)
    Support for decimal (and numeric) precision.
    Parameters:
      `precision` - Precision
    Returns:
      `true` when DECIMAL (and NUMERIC) support the supplied precision; 0 or negative precision always return `false`

  - ### maxDecimalPrecision

    public int maxDecimalPrecision()
    Returns:
      The maximum decimal and numeric precision

  - ### supportsInt128

    public boolean supportsInt128()
    Returns:
      `true` when the data type INT128 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()
    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

  - ### supportsReturningAll

    public boolean supportsReturningAll()
    Returns:
      `true` when `RETURNING *` and `RETURNING ref.*` is supported.

  - ### supportsMultiRowReturning

    public boolean supportsMultiRowReturning()
    Returns:
      `true` when `RETURNING` supports multiple rows, `false` only singleton results

  - ### 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-16 and 18-19 at this time, although v14 is only implemented as part of v15).
    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 (e.g. 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()

  - ### supportsWireCryptArc4

    public boolean supportsWireCryptArc4()

  - ### supportsWireCryptChaCha

    public boolean supportsWireCryptChaCha()

  - ### supportsWireCryptChaCha64

    public boolean supportsWireCryptChaCha64()

  - ### supportsWireCompression

    public boolean supportsWireCompression()
    Returns:
      `true` when zlib wire compression is supported

  - ### supportsNativeUserDefinedFunctions

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

  - ### supportsPsqlFunctions

    public boolean supportsPsqlFunctions()
    Returns:
      `true` when PSQL functions are supported

  - ### supportsAuthenticationPlugin

    public boolean supportsAuthenticationPlugin(String pluginName)
    Checks whether the Firebird version supports a plugin name.

    Firebird version 2.5 and earlier are considered to support only `Legacy_Auth`.

    NOTE: This method only checks if the specified plugin was shipped with a Firebird version, it does not check whether the plugin is enabled, nor if additional plugins are installed.

    Parameters:
      `pluginName` - Authentication plugin name (case-sensitive)
    Returns:
      `true` if supported, `false` otherwise.

  - ### supportsRecordVersionPseudoColumn

    public boolean supportsRecordVersionPseudoColumn()
    Returns:
      `true` when `RDB$RECORD_VERSION` pseudo column is supported

  - ### getSystemTableCount

    public int getSystemTableCount()
    The number of system tables (including monitoring tables).
    Returns:
      Number of system tables, or `-1` if the Firebird version is not known/supported.

  - ### supportsCaseSensitiveUserNames

    public boolean supportsCaseSensitiveUserNames()
    Returns:
      `true` when this Firebird version supports case-sensitive usernames.

  - ### supportsExplainedExecutionPlan

    public boolean supportsExplainedExecutionPlan()
    Returns:
      `true` when this Firebird version supports explained (detailed) execution plans.

  - ### supportsTimeZones

    public boolean supportsTimeZones()
    Returns:
      `true` when this Firebird version supports `TIME(STAMP) WITH TIME ZONE`

  - ### supportsPackages

    public boolean supportsPackages()
    Returns:
      `true` when this Firebird version supports packages.

  - ### supportsFloatBinaryPrecision

    public boolean supportsFloatBinaryPrecision()
    Returns:
      `true` when this Firebird version supports FLOAT(p) with binary precision.

  - ### supportsStatementTimeouts

    public boolean supportsStatementTimeouts()
    Returns:
      `true` when this Firebird version supports statement timeouts.

  - ### supportsStatementUnprepare

    public boolean supportsStatementUnprepare()
    Returns:
      `true` when this Firebird version supports statement unprepare (`DSQL_unprepare`)

  - ### supportsNBackupWithGuid

    public boolean supportsNBackupWithGuid()
    Returns:
      `true` when this Firebird version supports NBackup backup with GUID

  - ### supportsNBackupInPlaceRestore

    public boolean supportsNBackupInPlaceRestore()
    Returns:
      `true` when this Firebird version supports NBackup in-place restore

  - ### supportsNBackupFixup

    public boolean supportsNBackupFixup()
    Returns:
      `true` when this Firebird version supports NBackup fixup

  - ### supportsNBackupPreserveSequence

    public boolean supportsNBackupPreserveSequence()
    Returns:
      `true` when this Firebird version supports NBackup preserve sequence

  - ### supportsNBackupCleanHistory

    public boolean supportsNBackupCleanHistory()
    Returns:
      `true` when this Firebird version supports NBackup clean history

  - ### supportsScrollableCursors

    public boolean supportsScrollableCursors()
    Returns:
      `true` when this Firebird version supports scrollable cursors. (NOTE: this does not mean the connection supports it, as that depends on the actual protocol (i.e. PURE_JAVA or derivative))

  - ### supportsServerBatch

    public boolean supportsServerBatch()
    Returns:
      `true` when this Firebird version supports server-side batch updates. (NOTE: this does not mean the connection supports it, as that depends on the actual protocol (i.e. PURE_JAVA or derivative))

  - ### supportsCustomSecurityDb

    public boolean supportsCustomSecurityDb()
    Returns:
      `true` when this Firebird version supports custom security databases

  - ### supportsWnet

    public boolean supportsWnet()

  - ### supportsStatementTextLongerThan64K

    public boolean supportsStatementTextLongerThan64K()
    Returns:
      `true` when this Firebird version supports statement texts longer than 64KB

  - ### supportsParallelWorkers

    public boolean supportsParallelWorkers()
    Returns:
      `true` when this Firebird version supports parallel workers

  - ### supportsRDB$CONFIG

    public boolean supportsRDB$CONFIG()
    Returns:
      `true` when this Firebird version has the `RDB$CONFIG` table

  - ### supportsUpgradeOds

    public boolean supportsUpgradeOds()
    Returns:
      `true` if the gfix/service repair option upgrade ODS is supported

  - ### supportsFixIcu

    public boolean supportsFixIcu()
    Returns:
      `true` if the gfix/service repair option icu (fix ICU) is supported

  - ### supportsParameterizedExceptions

    public boolean supportsParameterizedExceptions()
    Returns:
      `true` if PSQL parameterized exceptions are supported (`exception ... using (...)`)

  - ### supportsDatabaseTriggers

    public boolean supportsDatabaseTriggers()
    Returns:
      `true` if database triggers are supported (`ON { CONNECT | DISCONNECT | TRANSACTION {START | COMMIT | ROLLBACK } }`)

  - ### supportsPartialIndices

    public boolean supportsPartialIndices()
    Returns:
      `true` if partial indices are supported

  - ### supportsNamelessServiceManager

    public boolean supportsNamelessServiceManager()
    Returns:
      `true` if the nameless service manager is supported

  - ### supportsMetadataPrivileges

    public boolean supportsMetadataPrivileges()
    Returns:
      `true` if server supports metadata privileges like `CREATE DATABASE`

  - ### supportsLegacyMultiFileDatabase

    public boolean supportsLegacyMultiFileDatabase()
    Returns:
      `true` if server supports legacy multi-file databases

  - ### getDefaultOdsVersion

    public OdsVersion getDefaultOdsVersion()
    Returns:
      the ODS version used when creating a database or after using the gfix/service repair upgrade database option

  - ### supportsOds

    public boolean supportsOds(int major, int minor)
    Reports if the specified ODS version is supported.
    Parameters:
      `major` - ODS major
      `minor` - ODS minor
    Returns:
      `true` if the ODS is supported, `false` otherwise
    See Also:
      - `supportsOds(OdsVersion)`

  - ### supportsOds

    public boolean supportsOds(OdsVersion odsVersion)
    Reports if the specified ODS version is supported.
    Parameters:
      `odsVersion` - ODS version
    Returns:
      `true` if the ODS is supported, `false` otherwise
    See Also:
      - `supportsOds(int, int)`

  - ### supportsInlineBlobs

    public boolean supportsInlineBlobs()
    Reports if inline blobs are supported.
    Returns:
      `true` if inline blobs are supported, `false` otherwise

  - ### isSupportedVersion

    public boolean isSupportedVersion()
    Returns:
      `true` when this Firebird version is considered a supported version

  - ### hasProcedureTypeColumn

    public boolean hasProcedureTypeColumn()
    Returns:
      `true` if the default ODS of this Firebird version has column `RDB$PROCEDURE_TYPE`

  - ### isWindows

    public boolean isWindows()

  - ### 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(Connection connection)
    Parameters:
      `connection` - A database connection (NOTE: `Connection` is used, but it must be or unwrap to a `FirebirdConnection`).
    Returns:
      FirebirdVersionSupport instance
    Throws:
      `IllegalArgumentException` - When the provided connection is not an instance of or wrapper for `FirebirdConnection`
      `IllegalStateException` - When an SQLException occurs unwrapping the connection, or creating the `FirebirdSupportInfo` instance