Class TermEncoder


  • public final class TermEncoder
    extends java.lang.Object
    Creates SQL fragments for table and column identifiers, value literals and placeholders.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canEncode​(int jdbcType)
      Whether it can encode something as String.
      java.lang.String encodeColumnRef​(java.lang.String columnName)
      Encodes reference to a column name.
      java.lang.String encodeIdentifier​(java.lang.String id)
      Encodes an identifier.
      java.lang.String encodeLiteral​(java.lang.Object value, int jdbcType)
      Encodes the literal 'value' in a form suitable for the desired column type (colType).
      java.lang.String encodeParamReference​(java.lang.String paramName, int jdbcType)  
      java.lang.String encodePlaceholder​(int jdbcType)
      Encodes a placeholder character.
      java.lang.String encodeTableColumnRef​(SchemaQualifiedName tableName, java.lang.String columnName)  
      java.lang.String encodeTableRef​(SchemaQualifiedName tableName)
      Encodes reference to a table name.
      DBType getDBType()
      Gets the database type used in this TermEncoder.
      int getMaxElementsInList()
      Gets the maximum number of elements allowed in a SQL IN () clause.
      boolean isLobPrefetched()
      Determines whether a LOB column value is automatically pre-fetched by the database and JDBC.
      boolean isOrderByColsMustBeInSelectCols()
      Determines whether a column in ORDER BY clause has to be among the SELECT columns.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • encodeLiteral

        public java.lang.String encodeLiteral​(java.lang.Object value,
                                              int jdbcType)
        Encodes the literal 'value' in a form suitable for the desired column type (colType).
        Parameters:
        value - The literal value, possibly null
        jdbcType - The type of the value.
        Returns:
        The 'value' as a SQL literal.
      • encodePlaceholder

        public java.lang.String encodePlaceholder​(int jdbcType)
        Encodes a placeholder character. Typically just a question mark character '?', but can be wrapped in various functions for certain jdbcType.
        Parameters:
        jdbcType - The type of the values that will be set to this placeholder.
        Returns:
        The placeholder SQL fragment.
      • encodeIdentifier

        public java.lang.String encodeIdentifier​(java.lang.String id)
        Encodes an identifier.
        Parameters:
        id -
        Throws:
        java.lang.IllegalArgumentException
      • encodeTableRef

        public java.lang.String encodeTableRef​(SchemaQualifiedName tableName)
        Encodes reference to a table name.
        Parameters:
        tableName -
        Returns:
        The valid identifier (table reference)
      • encodeColumnRef

        public java.lang.String encodeColumnRef​(java.lang.String columnName)
        Encodes reference to a column name.
        Parameters:
        columnName -
        Returns:
        The valid identifier (column reference)
      • encodeTableColumnRef

        public java.lang.String encodeTableColumnRef​(SchemaQualifiedName tableName,
                                                     java.lang.String columnName)
      • encodeParamReference

        public java.lang.String encodeParamReference​(java.lang.String paramName,
                                                     int jdbcType)
      • canEncode

        public boolean canEncode​(int jdbcType)
        Whether it can encode something as String.
        Parameters:
        jdbcType -
      • getMaxElementsInList

        public int getMaxElementsInList()
        Gets the maximum number of elements allowed in a SQL IN () clause.
        Returns:
        The maximum IN clause elements.
        Since:
        5.12
      • getDBType

        public DBType getDBType()
        Gets the database type used in this TermEncoder.
        Returns:
        The database type.
        Since:
        5.12
      • isOrderByColsMustBeInSelectCols

        public boolean isOrderByColsMustBeInSelectCols()
        Determines whether a column in ORDER BY clause has to be among the SELECT columns.
        Returns:
        true, if ORDER BY columns must also be in the SELECT result.
        Since:
        5.12
      • isLobPrefetched

        public boolean isLobPrefetched()
        Determines whether a LOB column value is automatically pre-fetched by the database and JDBC.
        Returns:
        true, if LOB columns are pre-fetched, otherwise false.
        Since:
        5.12