Class FirebirdDictionary

    • Field Detail

      • firebirdVersion

        public int firebirdVersion
      • indexedVarcharMaxSizeFB15

        public int indexedVarcharMaxSizeFB15
      • rangeSyntax

        public java.lang.String rangeSyntax
      • maxRowNumberInRange

        protected long maxRowNumberInRange
      • alterSequenceSQLFB15

        protected java.lang.String alterSequenceSQLFB15
      • alterSequenceSQLFB20

        protected java.lang.String alterSequenceSQLFB20
      • createSequenceSQLFB15

        protected java.lang.String createSequenceSQLFB15
      • createSequenceSQLFB20

        protected java.lang.String createSequenceSQLFB20
      • dropSequenceSQLFB15

        protected java.lang.String dropSequenceSQLFB15
      • alterSequenceSQL

        protected java.lang.String alterSequenceSQL
      • createSequenceSQL

        protected java.lang.String createSequenceSQL
      • RANGE_SYNTAX_FIRST_SKIP

        public static final java.lang.String RANGE_SYNTAX_FIRST_SKIP
        See Also:
        Constant Field Values
      • RANGE_SYNTAX_ROWS

        public static final java.lang.String RANGE_SYNTAX_ROWS
        See Also:
        Constant Field Values
    • Constructor Detail

      • FirebirdDictionary

        public FirebirdDictionary()
    • Method Detail

      • connectedConfiguration

        public void connectedConfiguration​(java.sql.Connection conn)
                                    throws java.sql.SQLException
        Determine Firebird version and configure itself accordingly.
        Overrides:
        connectedConfiguration in class DBDictionary
        Throws:
        java.sql.SQLException
      • appendSelectRange

        protected void appendSelectRange​(SQLBuffer buf,
                                         long start,
                                         long end,
                                         boolean subselect)
        Use either FIRST <p> SKIP <q> or ROWS <m> TO <n> syntax. If ROWS variant is used and end equals Long.MAX_VALUE, a constant is used as <n> value.
        Overrides:
        appendSelectRange in class DBDictionary
      • determineFirebirdVersion

        protected int determineFirebirdVersion​(java.sql.Connection con)
                                        throws java.sql.SQLException
        Determine Firebird version either by using JDBC 3 methods or, if they are not available, by parsing the value returned by DatabaseMetaData.getDatabaseProductVersion(). User can override Firebird version.
        Throws:
        java.sql.SQLException
      • determineRangeSyntax

        protected void determineRangeSyntax()
        Determine range syntax to be used depending on Firebird version. User can override range syntax.
      • getTableNameForMetadata

        protected java.lang.String getTableNameForMetadata​(java.lang.String tableName)
        Return % if tableName is null, otherwise delegate to super implementation.
        Overrides:
        getTableNameForMetadata in class DBDictionary
      • getTableNameForMetadata

        protected java.lang.String getTableNameForMetadata​(DBIdentifier tableName)
        Description copied from class: DBDictionary
        Returns the table name that will be used for obtaining information from DatabaseMetaData.
        Overrides:
        getTableNameForMetadata in class DBDictionary
      • getColumnNameForMetadata

        protected java.lang.String getColumnNameForMetadata​(java.lang.String columnName)
        Return % if columnName is null, otherwise delegate to super implementation.
        Overrides:
        getColumnNameForMetadata in class DBDictionary
      • getDropColumnSQL

        public java.lang.String[] getDropColumnSQL​(Column column)
        Return ALTER TABLE <table name> DROP <col name>.
        Overrides:
        getDropColumnSQL in class DBDictionary
      • getCreateSequenceSQL

        public java.lang.String[] getCreateSequenceSQL​(Sequence seq)
        Return either CREATE SEQUENCE <sequence name> or CREATE GENERATOR <sequence name>. If initial value of sequence is set, return also an appropriate ALTER statement.
        Overrides:
        getCreateSequenceSQL in class DBDictionary
      • getSequencesSQL

        protected java.lang.String getSequencesSQL​(java.lang.String schemaName,
                                                   java.lang.String sequenceName)
        Return Firebird-specific statement to select the list of sequences.
        Overrides:
        getSequencesSQL in class DBDictionary
      • newSequence

        protected Sequence newSequence​(java.sql.ResultSet sequenceMeta)
                                throws java.sql.SQLException
        Call super implementation and trim sequence name. This is because of trailing spaces problem: RDB$GENERATORS.RDB$GENERATOR_NAME is CHAR(31) and using RTRIM UDF function on Firebird 1.5 surprisingly returns a string right-padded with spaces up to the length of 255.
        Overrides:
        newSequence in class DBDictionary
        Throws:
        java.sql.SQLException
      • getDropSequenceSQL

        public java.lang.String[] getDropSequenceSQL​(Sequence seq)
        On Firebird 1.5 return DROP GENERATOR <sequence name>. On Firebird 2.0 and later delegate to the super implementation.
        Overrides:
        getDropSequenceSQL in class DBDictionary
      • indexOf

        public void indexOf​(SQLBuffer buf,
                            FilterValue str,
                            FilterValue find,
                            FilterValue start)
        On Firebird 2.1 return POSITION(<find>, <str> [, <start>]). On older versions throw UnsupportedException - no suitable function exists.
        Overrides:
        indexOf in class DBDictionary
        Parameters:
        buf - the SQL buffer to write the indexOf invocation to
        str - a query value representing the target string
        find - a query value representing the search string
        start - a query value representing the start index, or null to start at the beginning
      • substring

        public void substring​(SQLBuffer buf,
                              FilterValue str,
                              FilterValue start,
                              FilterValue length)
        Use SUBSTRING(<col name> FROM <m> FOR <n>). Parameters are inlined because neither parameter binding nor expressions are accepted by Firebird here. As a result, an UnsupportedException is thrown when something else than a constant is used in start or length.
        Overrides:
        substring in class DBDictionary
        Parameters:
        buf - the SQL buffer to write the substring invocation to
        str - a query value representing the target string
        start - a query value representing the start index
        length - a query value representing the length of substring, or null for none
      • appendSize

        protected java.lang.String appendSize​(Column col,
                                              java.lang.String typeName)
        On Firebird 1.5 reduce the size of indexed VARCHAR column to 252 or a value specified by user. 252 is the maximum Firebird 1.5 can handle for one-column indexes. On Firebird 2.0 and later delegate to the super implementation.
        Overrides:
        appendSize in class DBDictionary
      • matchErrorState

        protected int matchErrorState​(java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> errorStates,
                                      java.sql.SQLException ex)
        Use error code as SQL state returned by Firebird is ambiguous.
        Overrides:
        matchErrorState in class DBDictionary
        Parameters:
        errorStates - classification of SQL error states by their specific nature. The keys of the map represent one of the constants defined in StoreException. The value corresponding to a key represent the set of SQL Error States representing specific category of database error. This supplied map is sourced from sql-error-state-codes.xml and filtered the error states for the current database.
        ex - original SQL Exception as raised by the database driver.
        Returns:
        A constant indicating the category of error as defined in StoreException.