Class DB2Dictionary

    • Field Detail

      • optimizeClause

        public java.lang.String optimizeClause
      • rowClause

        public java.lang.String rowClause
      • db2ServerType

        protected int db2ServerType
      • db2ISeriesV5R3OrEarlier

        public static final int db2ISeriesV5R3OrEarlier
        See Also:
        Constant Field Values
      • useKeepShareLockClause

        protected static final java.lang.String useKeepShareLockClause
        See Also:
        Constant Field Values
      • useKeepUpdateLockClause

        protected static final java.lang.String useKeepUpdateLockClause
        See Also:
        Constant Field Values
      • useKeepExclusiveLockClause

        protected static final java.lang.String useKeepExclusiveLockClause
        See Also:
        Constant Field Values
      • forReadOnlyClause

        protected static final java.lang.String forReadOnlyClause
        See Also:
        Constant Field Values
      • defaultSequenceSQL

        protected static final java.lang.String defaultSequenceSQL
        See Also:
        Constant Field Values
      • appendExtendedExceptionText

        public boolean appendExtendedExceptionText
      • supportsRowNum

        public boolean supportsRowNum
        Affirms whether this dictionary uses ROWNUM feature. ROWNUM feature is used to construct SQL SELECT query that uses an offset or limits the number of resultant rows.
        By default, this flag is set to false.
    • Constructor Detail

      • DB2Dictionary

        public DB2Dictionary()
    • Method Detail

      • appendSelectRange

        protected void appendSelectRange​(SQLBuffer buf,
                                         long start,
                                         long end,
                                         boolean subselect)
        Description copied from class: DBDictionary
        If this dictionary can select ranges, use this method to append the range SQL.
        Overrides:
        appendSelectRange in class DBDictionary
      • appendSelect

        protected void appendSelect​(SQLBuffer selectSQL,
                                    java.lang.Object alias,
                                    Select sel,
                                    int idx)
        Description copied from class: DBDictionary
        Append elem to selectSQL.
        Overrides:
        appendSelect in class DBDictionary
        Parameters:
        selectSQL - The SQLBuffer to append to.
        alias - A SQLBuffer or a String to append.
      • getSequencesSQL

        protected java.lang.String getSequencesSQL​(java.lang.String schemaName,
                                                   java.lang.String sequenceName)
        Description copied from class: DBDictionary
        Return the SQL needed to select the list of sequences.
        Overrides:
        getSequencesSQL in class DBDictionary
      • decorate

        public java.sql.Connection decorate​(java.sql.Connection conn)
                                     throws java.sql.SQLException
        Description copied from class: DBDictionary
        Decorate the given connection if needed. Some databases require special handling for JDBC bugs. This implementation issues any DBDictionary.initializationSQL that has been set for the dictionary but does not decorate the connection.
        Specified by:
        decorate in interface ConnectionDecorator
        Overrides:
        decorate in class DBDictionary
        Throws:
        java.sql.SQLException
      • connectedConfiguration

        public void connectedConfiguration​(java.sql.Connection conn)
                                    throws java.sql.SQLException
        Description copied from class: DBDictionary
        This method is called when the dictionary first sees any connection. It is used to initialize dictionary metadata if needed. If you override this method, be sure to call super.connectedConfiguration.
        Overrides:
        connectedConfiguration in class DBDictionary
        Throws:
        java.sql.SQLException
      • supportsIsolationForUpdate

        public boolean supportsIsolationForUpdate()
        Description copied from class: DBDictionary
        Return true if the dictionary uses isolation level to compute the returned getForUpdateClause() SQL clause.
        Overrides:
        supportsIsolationForUpdate in class DBDictionary
      • getForUpdateClause

        protected java.lang.String getForUpdateClause​(JDBCFetchConfiguration fetch,
                                                      boolean isForUpdate,
                                                      Select sel)
        Get the update clause for the query based on the isolationLevel hints if it is for update. It also handles the UR hint when it is not for update.
        Overrides:
        getForUpdateClause in class DBDictionary
      • isDB2UDBV82OrLater

        public boolean isDB2UDBV82OrLater()
      • isDB2ZOSV8xOrLater

        public boolean isDB2ZOSV8xOrLater()
      • isDB2ISeriesV5R3OrEarlier

        public boolean isDB2ISeriesV5R3OrEarlier()
      • isDB2ISeriesV5R4OrLater

        public boolean isDB2ISeriesV5R4OrLater()
      • isDB2ISeriesV5R4OrEarlier

        public boolean isDB2ISeriesV5R4OrEarlier()
      • isDB2UDBV81OrEarlier

        public boolean isDB2UDBV81OrEarlier()
      • getOptimizeClause

        protected java.lang.String getOptimizeClause​(Select sel)
      • newStoreException

        public OpenJPAException newStoreException​(java.lang.String msg,
                                                  java.sql.SQLException[] causes,
                                                  java.lang.Object failed)
        Description copied from class: DBDictionary
        Return a new exception that wraps causes. However, the details of exactly what type of exception is returned can be determined by the implementation. This may take into account DB-specific exception information in causes.
        Overrides:
        newStoreException in class DBDictionary
      • getDb2ServerType

        public int getDb2ServerType()
      • appendXmlComparison

        public void appendXmlComparison​(SQLBuffer buf,
                                        java.lang.String op,
                                        FilterValue lhs,
                                        FilterValue rhs,
                                        boolean lhsxml,
                                        boolean rhsxml)
        If this dictionary supports XML type, use this method to append xml predicate.
        Overrides:
        appendXmlComparison in class DBDictionary
        Parameters:
        buf - the SQL buffer to write the comparison
        op - the comparison operation to perform
        lhs - the left hand side of the comparison
        rhs - the right hand side of the comparison
        lhsxml - indicates whether the left operand maps to xml
        rhsxml - indicates whether the right operand maps to xml
      • addCastAsType

        public java.lang.String addCastAsType​(java.lang.String func,
                                              Val val)
        add CAST for a function operator where operand is a param
        Overrides:
        addCastAsType in class DBDictionary
        Parameters:
        func - function name
        val - type
        Returns:
        updated string (func)
      • getBatchLimit

        public int getBatchLimit()
        Return the batch limit. If the batchLimit is -1, change it to 100 for best performance
        Overrides:
        getBatchLimit in class DBDictionary
      • getCastFunction

        public java.lang.String getCastFunction​(Val val,
                                                java.lang.String func)
        Return the correct CAST function syntax
        Overrides:
        getCastFunction in class DBDictionary
        Parameters:
        val - operand of cast
        func - original string
        Returns:
        a String with the correct CAST function syntax
      • getCastFunction

        public java.lang.String getCastFunction​(Val val,
                                                java.lang.String func,
                                                Column col)
        Return the correct CAST function syntax
        Overrides:
        getCastFunction in class DBDictionary
        Parameters:
        val - operand of cast
        func - original string
        col - database column
        Returns:
        a String with the correct CAST function syntax
      • indexOf

        public void indexOf​(SQLBuffer buf,
                            FilterValue str,
                            FilterValue find,
                            FilterValue start)
        Description copied from class: DBDictionary
        Invoke this database's indexOf function.
        Overrides:
        indexOf in class AbstractDB2Dictionary
        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
      • appendCast

        public void appendCast​(SQLBuffer buf,
                               FilterValue val,
                               int type)
        Cast the specified value to the specified type.
        Parameters:
        buf - the buffer to append the cast to
        val - the value to cast
        type - the type of the case, e.g. Types.NUMERIC
      • createIndexIfNecessary

        public void createIndexIfNecessary​(Schema schema,
                                           java.lang.String table,
                                           Column pkColumn)
        Create an index if necessary for some database tables
        Overrides:
        createIndexIfNecessary in class DBDictionary
      • isFatalException

        public boolean isFatalException​(int subtype,
                                        java.sql.SQLException ex)
        Description copied from class: DBDictionary
        Determine if the given SQL Exception is fatal or recoverable (such as a timeout). This implementation always returns true (i.e. all exceptions are fatal). The current dictionary implementation can overwrite this method to mark certain exception conditions as recoverable error.
        Overrides:
        isFatalException in class DBDictionary
        Parameters:
        subtype - A constant indicating the category of error as defined in StoreException.
        ex - original SQL Exception as raised by the database driver.
        Returns:
        false if the error is fatal.
      • setDelimitedCase

        protected void setDelimitedCase​(java.sql.DatabaseMetaData metaData)
        Overrides:
        setDelimitedCase in class DBDictionary
      • setQueryTimeout

        public void setQueryTimeout​(java.sql.PreparedStatement stmnt,
                                    int timeout)
                             throws java.sql.SQLException
        The Type 2 JDBC Driver may throw an SQLException when provided a non- zero timeout if we're connected to Z/OS. The SQLException should be logged but not thrown.
        Overrides:
        setQueryTimeout in class DBDictionary
        timeout - in milliseconds
        Throws:
        java.sql.SQLException
      • setBytes

        public void setBytes​(java.sql.PreparedStatement stmnt,
                             int idx,
                             byte[] val,
                             Column col)
                      throws java.sql.SQLException
        Set the given value as a parameter to the statement.
        Overrides:
        setBytes in class DBDictionary
        Throws:
        java.sql.SQLException
      • getBytes

        public byte[] getBytes​(java.sql.ResultSet rs,
                               int column)
                        throws java.sql.SQLException
        Convert the specified column of the SQL ResultSet to the proper java type.
        Overrides:
        getBytes in class DBDictionary
        Throws:
        java.sql.SQLException
      • insertClobForStreamingLoad

        public void insertClobForStreamingLoad​(Row row,
                                               Column col,
                                               java.lang.Object ob)
                                        throws java.sql.SQLException
        Overrides:
        insertClobForStreamingLoad in class DBDictionary
        Throws:
        java.sql.SQLException
      • updateBlob

        public void updateBlob​(Select sel,
                               JDBCStore store,
                               java.io.InputStream is)
                        throws java.sql.SQLException
        Overrides:
        updateBlob in class DBDictionary
        Throws:
        java.sql.SQLException
      • updateClob

        public void updateClob​(Select sel,
                               JDBCStore store,
                               java.io.Reader reader)
                        throws java.sql.SQLException
        Overrides:
        updateClob in class DBDictionary
        Throws:
        java.sql.SQLException
      • setDate

        public void setDate​(java.sql.PreparedStatement stmnt,
                            int idx,
                            java.util.Date val,
                            Column col)
                     throws java.sql.SQLException
        Set the given date value as a parameter to the statement.
        Overrides:
        setDate in class DBDictionary
        Throws:
        java.sql.SQLException
      • getDB2MajorVersion

        public int getDB2MajorVersion()
      • getDB2MinorVersion

        public int getDB2MinorVersion()