Class FirebirdDictionary

    • Field Detail

      • firebirdVersion

        public int firebirdVersion
      • indexedVarcharMaxSizeFB15

        public int indexedVarcharMaxSizeFB15
      • rangeSyntax

        public String rangeSyntax
      • maxRowNumberInRange

        protected long maxRowNumberInRange
      • alterSequenceSQLFB15

        protected String alterSequenceSQLFB15
      • alterSequenceSQLFB20

        protected String alterSequenceSQLFB20
      • createSequenceSQLFB15

        protected String createSequenceSQLFB15
      • createSequenceSQLFB20

        protected String createSequenceSQLFB20
      • dropSequenceSQLFB15

        protected String dropSequenceSQLFB15
      • alterSequenceSQL

        protected String alterSequenceSQL
      • createSequenceSQL

        protected String createSequenceSQL
    • Constructor Detail

      • FirebirdDictionary

        public FirebirdDictionary()
    • Method Detail

      • 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
      • determineRangeSyntax

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

        public 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
      • newSequence

        protected Sequence newSequence​(ResultSet sequenceMeta)
                                throws 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:
        SQLException
      • getDropSequenceSQL

        public 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 String appendSize​(Column col,
                                    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​(Map<Integer,​Set<String>> errorStates,
                                      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.