Interface Query

  • All Known Subinterfaces:
    SecureQuery
    All Known Implementing Classes:
    WrappingQuery

    public interface Query
    This is a Query interface, representing all queries in various languages for various stores.

    Note that it was modeled after the JCR Query interface.

    Since:
    1.6M1
    Version:
    $Id: 9c104e1d31f17abb4e52d8d890aa4b523f97cf5c $
    • Method Detail

      • getStatement

        String getStatement()
        Returns:
        Query statement or query name depends on isNamed()
      • getLanguage

        String getLanguage()
        Returns:
        Query language. See HQL and others.
      • isNamed

        boolean isNamed()
        if the query is named, then getStatement() returns a name of the query, else - a query statement.
        Returns:
        is the query named.
      • setWiki

        Query setWiki​(String wiki)
        Parameters:
        wiki - virtual wiki to run the query. null is a current wiki.
        Returns:
        this query
      • getWiki

        String getWiki()
        Returns:
        virtual wiki to run the query. null is a current wiki.
        See Also:
        setWiki(String)
      • bindValue

        Query bindValue​(String var,
                        Object val)
        Bind named parameter var with value val in query statement.
        Parameters:
        var - variable in query statement (:var).
        val - value of the variable.
        Returns:
        this query
      • bindValue

        Query bindValue​(int index,
                        Object val)
        Bind a positional parameter present in the statement (?index in XWQL) with a value. It is recommended to use named parameters if it acceptable, see bindValue(String, Object).
        Parameters:
        index - index of positional parameter. Index starting number depends on the query language. According to the JPQL standard index should start from 1.
        val - value of the variable.
        Returns:
        this query
      • bindValues

        Query bindValues​(List<Object> values)
        Bind a list of positional parameters values. This method is a convenience method allowing passing a list of values in one call instead of multiple calls to bindValue(int, Object).
        Parameters:
        values - list of positional parameters values.
        Returns:
        this query
        See Also:
        bindValue(int, Object)
      • bindValues

        default Query bindValues​(Map<String,​?> values)
        Bind a map of named parameters values. This method is a convenience method allowing passing a map of values in one call instead of multiple calls to bindValue(String, Object).
        Parameters:
        values - list of positional parameters values.
        Returns:
        this query
        Since:
        11.5RC1
        See Also:
        bindValue(String, Object)
      • setLimit

        Query setLimit​(int limit)
        Parameters:
        limit - see getLimit()
        Returns:
        this query
      • setOffset

        Query setOffset​(int offset)
        Parameters:
        offset - offset of query result to set (skip first "offset" rows)
        Returns:
        this query
      • getLimit

        int getLimit()
        Returns:
        limit the limit of result list to set (execute().size() <= limit)
        See Also:
        setLimit(int)
      • getOffset

        int getOffset()
        Returns:
        offset offset of query result.
        See Also:
        setOffset(int)
      • execute

        <T> List<T> execute()
                     throws QueryException
        Type Parameters:
        T - expected type of elements in the result list.
        Returns:
        result list of the query. If several fields are selected then T=Object[].
        Throws:
        QueryException - if something goes wrong.