Class 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 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
      • 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
      • 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()
        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
      • 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 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.
      • 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()
      • 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​(java.lang.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
      • supportsPartialIndices

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

        public boolean supportsOds​(int odsMajor,
                                   int odsMinor)
        Parameters:
        odsMajor - ODS major version
        odsMinor - ODS minor version
        Returns:
        true if the specified ODS is supported
      • 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​(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