org.apache.cayenne.dba.derby

## Class DerbyQualifierTranslator

- java.lang.Object
- - org.apache.cayenne.access.translator.select.QueryAssemblerHelper
  - - org.apache.cayenne.access.translator.select.QualifierTranslator
    - - org.apache.cayenne.access.translator.select.TrimmingQualifierTranslator
      - - org.apache.cayenne.dba.derby.DerbyQualifierTranslator

- All Implemented Interfaces:
    TraversalHandler

      public class DerbyQualifierTranslator
      extends TrimmingQualifierTranslator

- - ### Field Summary

    - ### Fields inherited from class org.apache.cayenne.access.translator.select.TrimmingQualifierTranslator

      `trimFunction`

    - ### Fields inherited from class org.apache.cayenne.access.translator.select.QualifierTranslator

      `caseInsensitive, matchingObject, objectMatchTranslator, qualifier, useAliasForExpressions, waitingForEndNode`

    - ### Fields inherited from class org.apache.cayenne.access.translator.select.QueryAssemblerHelper

      `out, queryAssembler, strategy`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DerbyQualifierTranslator(QueryAssembler queryAssembler, String trimFunction)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `appendExtractFunction(ASTExtract functionExpression)` Special case for extract date/time parts functions as they have many variants
    `protected void` | `appendFunction(ASTFunctionCall functionExpression)` Append function name to result SQL Override this method to rename or skip function if generic name isn't supported on target DB.
    `protected void` | `appendFunctionArg(Object value, ASTFunctionCall functionExpression)` A little bit ugly code that wraps String scalars to CAST(? AS VARCHAR(length)) because otherwise derby don't know what type will be at the placeholder and use LONG VARCHAR that isn't comparable what leads to statement preparation failure.
    `protected void` | `appendFunctionArgDivider(ASTFunctionCall functionExpression)` Append divider between function arguments.
    `protected void` | `clearLastFunctionArgDivider(ASTFunctionCall functionExpression)` Clear last divider as we currently don't now position of argument until parent element is ended.
    `protected void` | `processColumnWithQuoteSqlIdentifiers(DbAttribute dbAttr, Expression pathExp)` Adds special handling of CHAR columns.

    - ### Methods inherited from class org.apache.cayenne.access.translator.select.TrimmingQualifierTranslator

      `getTrimFunction, processColumn, setTrimFunction`

    - ### Methods inherited from class org.apache.cayenne.access.translator.select.QualifierTranslator

      `appendLiteral, appendObjectMatch, detectObjectMatch, doAppendPart, doAppendPart, endNode, extractQualifier, finishedChild, objectNode, operandForBitwiseAnd, operandForBitwiseLeftShift, operandForBitwiseNot, operandForBitwiseOr, operandForBitwiseRightShift, operandForBitwiseXor, parenthesisNeeded, processRelTermination, setCaseInsensitive, setQualifier, setUseAliasForExpressions, startNode`

    - ### Methods inherited from class org.apache.cayenne.access.translator.select.QueryAssemblerHelper

      `appendDbPath, appendLikeEscapeCharacter, appendLiteralDirect, appendObjPath, appendPart, getDbEntity, getObjEntity, paramsDbType, processRelTermination, setForceJoinForRelations`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DerbyQualifierTranslator

          public DerbyQualifierTranslator(QueryAssembler queryAssembler,
                                          String trimFunction)

  - ### Method Detail

    - #### processColumnWithQuoteSqlIdentifiers

          protected void processColumnWithQuoteSqlIdentifiers(DbAttribute dbAttr,
                                                              Expression pathExp)

      Description copied from class: `TrimmingQualifierTranslator`
      Adds special handling of CHAR columns.
      Overrides:
        `processColumnWithQuoteSqlIdentifiers` in class `TrimmingQualifierTranslator`

    - #### appendFunction

          protected void appendFunction(ASTFunctionCall functionExpression)

      Description copied from class: `QualifierTranslator`
      Append function name to result SQL Override this method to rename or skip function if generic name isn't supported on target DB.
      Overrides:
        `appendFunction` in class `QualifierTranslator`
      Since:
        4.0

    - #### appendFunctionArg

          protected void appendFunctionArg(Object value,
                                           ASTFunctionCall functionExpression)
                                    throws IOException

      A little bit ugly code that wraps String scalars to CAST(? AS VARCHAR(length)) because otherwise derby don't know what type will be at the placeholder and use LONG VARCHAR that isn't comparable what leads to statement preparation failure.
      Overrides:
        `appendFunctionArg` in class `QualifierTranslator`
      Throws:
        `IOException`
      Since:
        4.0

    - #### appendFunctionArgDivider

          protected void appendFunctionArgDivider(ASTFunctionCall functionExpression)

      Description copied from class: `QualifierTranslator`
      Append divider between function arguments. In overriding methods can be replaced e.g. for " || " for CONCAT operation
      Overrides:
        `appendFunctionArgDivider` in class `QualifierTranslator`
      Since:
        4.0

    - #### clearLastFunctionArgDivider

          protected void clearLastFunctionArgDivider(ASTFunctionCall functionExpression)

      Description copied from class: `QualifierTranslator`
      Clear last divider as we currently don't now position of argument until parent element is ended.
      Overrides:
        `clearLastFunctionArgDivider` in class `QualifierTranslator`
      Since:
        4.0

    - #### appendExtractFunction

          protected void appendExtractFunction(ASTExtract functionExpression)

      Description copied from class: `QualifierTranslator`
      Special case for extract date/time parts functions as they have many variants
      Overrides:
        `appendExtractFunction` in class `QualifierTranslator`

Copyright © 2001–2023 Apache Cayenne. All rights reserved.