Interface QueryParameter


  • public interface QueryParameter
    Represents a parameter of a Query. This is providing an API to represent a query parameter as made of several parts:
    • literal parts: those are constructed by calling literal(String) and their characters will be escaped when the Query will executed (i.e. %, _ and ! characters will get escaped)
    • special SQL characters: constructed by calling anyChars() and anychar() which correspond respectively to the % and _ SQL characters.
    Example:
    
     #set(xwql = "WHERE doc.fullName LIKE :space AND doc.fullName <> :fullName")
     #set ($query = $services.query.xwql(xwql))
     #set ($query = $query.bindValue('space').literal($doc.space).literal('.').anyChars().query())
     
    Since:
    8.4.5, 9.3RC1
    Version:
    $Id: a7b527d9f6129182107fec11b4c59d5a222b346c $
    • Method Detail

      • literal

        QueryParameter literal​(String literal)
        Parameters:
        literal - the characters that will get escaped at query execution time
        Returns:
        this object, in order to make the API fluent
      • like

        QueryParameter like​(String like)
        Parameters:
        like - the characters that will get executed as is (i.e no escape will be performed on them) at query execution time
        Returns:
        this object, in order to make the API fluent
      • anychar

        QueryParameter anychar()
        Append a _ character that will not be escaped.
        Returns:
        this object, in order to make the API fluent
      • anyChars

        QueryParameter anyChars()
        Append a % character that will not be escaped.
        Returns:
        this object, in order to make the API fluent
      • query

        Query query()
        Returns:
        the associated query to keep the API fluent