Class DerbyPlatform

    • Field Detail

      • isSequenceSupported

        protected boolean isSequenceSupported
        Allow sequence support to be disabled for Derby < 10.6.1.
      • isConnectionDataInitialized

        protected boolean isConnectionDataInitialized
    • Constructor Detail

      • DerbyPlatform

        public DerbyPlatform()
    • Method Detail

      • convertToDatabaseType

        public Object convertToDatabaseType​(Object value)
        Derby error the data type, length or value of arguments 'TIMESTAMP' and 'DATE' is incompatible. Instead, use a java.sql.Date type for property {d } casting
        Overrides:
        convertToDatabaseType in class DatabasePlatform
      • shouldPrintOutputTokenAtStart

        public boolean shouldPrintOutputTokenAtStart()
        This is required in the construction of the stored procedures with output parameters
        Overrides:
        shouldPrintOutputTokenAtStart in class DB2Platform
      • getSelectForUpdateString

        public String getSelectForUpdateString()
        Description copied from class: DB2Platform
        INTERNAL: Used for pessimistic locking in DB2. Without the "WITH RS" the lock is not held.
        Overrides:
        getSelectForUpdateString in class DB2Platform
      • shouldTempTableSpecifyPrimaryKeys

        protected boolean shouldTempTableSpecifyPrimaryKeys()
        INTERNAL: Indicates whether temporary table can specify primary keys (some platforms don't allow that). Used by writeCreateTempTableSql method.
        Overrides:
        shouldTempTableSpecifyPrimaryKeys in class DatabasePlatform
      • writeUpdateOriginalFromTempTableSql

        public void writeUpdateOriginalFromTempTableSql​(Writer writer,
                                                        DatabaseTable table,
                                                        Collection<DatabaseField> pkFields,
                                                        Collection<DatabaseField> assignedFields)
                                                 throws IOException
        INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work. Write an sql string for updating the original table from the temporary table. Precondition: supportsTempTables() == true. Precondition: pkFields and assignFields don't intersect.
        Overrides:
        writeUpdateOriginalFromTempTableSql in class DatabasePlatform
        Parameters:
        writer - for writing the sql
        table - is original table for which temp table is created.
        pkFields - - primary key fields for the original table.
        assignedFields - - fields to be assigned a new value.
        Throws:
        IOException
      • avgOperator

        protected ExpressionOperator avgOperator()
        Disable binding support.

        With binding enabled, Derby will throw an error:

        ERROR 42X36: The 'AVG' operator is not allowed to take a ? parameter as an operand.
      • sumOperator

        protected ExpressionOperator sumOperator()
        Disable binding support.

        With binding enabled, Derby will throw an error:

        ERROR 42X36: The 'SUM' operator is not allowed to take a ? parameter as an operand.
      • equalOperator

        protected ExpressionOperator equalOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '=' to be ? parameters.
      • notEqualOperator

        protected ExpressionOperator notEqualOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '<>' to be ? parameters.
      • greaterThanOperator

        protected ExpressionOperator greaterThanOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '>' to be ? parameters.
      • greaterThanEqualOperator

        protected ExpressionOperator greaterThanEqualOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '>=' to be ? parameters.
      • lessThanOperator

        protected ExpressionOperator lessThanOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '<' to be ? parameters.
      • lessThanEqualOperator

        protected ExpressionOperator lessThanEqualOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '<=' to be ? parameters.
      • addOperator

        protected ExpressionOperator addOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '+' to be ? parameters.
      • subtractOperator

        protected ExpressionOperator subtractOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '-' to be ? parameters.
      • multiplyOperator

        protected ExpressionOperator multiplyOperator()
        Set binding support to PARTIAL.

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '*' to be ? parameters.
      • divideOperator

        protected ExpressionOperator divideOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '/' to be ? parameters.
      • concatOperator

        protected ExpressionOperator concatOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of '||' to be ? parameters.
        Overrides:
        concatOperator in class DB2Platform
      • trim2

        protected ExpressionOperator trim2()
        Enable binding since DB2 disables it

        With binding enabled, Derby does not throw an exception

        Overrides:
        trim2 in class DB2Platform
      • modOperator

        protected ExpressionOperator modOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of 'mod' to be ? parameters.
      • betweenOperator

        protected ExpressionOperator betweenOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of 'BETWEEN' to be ? parameters.
      • notBetweenOperator

        protected ExpressionOperator notBetweenOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of 'BETWEEN' to be ? parameters.
      • inOperator

        protected ExpressionOperator inOperator()
        Derby requires that at least one argument be a known type

        With binding enabled, Derby will throw an error:

        ERROR 42X35: It is not allowed for both operands of 'IN' to be ? parameters.
      • isDynamicSQLRequiredForFunctions

        public boolean isDynamicSQLRequiredForFunctions()
        INTERNAL Derby has some issues with using parameters on certain functions and relations. This allows statements to disable binding, for queries, only in these cases. If users set casting on, then casting is used instead of dynamic SQL.
        Overrides:
        isDynamicSQLRequiredForFunctions in class DB2Platform
      • computeMaxRowsForSQL

        public int computeMaxRowsForSQL​(int firstResultIndex,
                                        int maxResults)
        INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute a value to use when limiting the results of a query in SQL. These limits tend to be used in two ways. 1. MaxRows is the index of the last row to be returned (like JDBC maxResults) 2. MaxRows is the number of rows to be returned Derby uses case #2 and therefore the maxResults has to be altered based on the firstResultIndex.
        Overrides:
        computeMaxRowsForSQL in class DatabasePlatform
        See Also:
        MySQLPlatform
      • supportsSequenceObjects

        public boolean supportsSequenceObjects()
        INTERNAL: Derby supports sequence objects as of 10.6.1.
        Overrides:
        supportsSequenceObjects in class DB2Platform
      • appendParameterInternal

        public int appendParameterInternal​(Call call,
                                           Writer writer,
                                           Object parameter)
        Returns the number of parameters that used binding. Should only be called in case binding is not used.
        Overrides:
        appendParameterInternal in class DatabasePlatform