Class CmsSelectQuery

java.lang.Object
org.opencms.db.CmsSelectQuery
All Implemented Interfaces:
I_CmsQueryFragment

public class CmsSelectQuery extends Object implements I_CmsQueryFragment
A class for generating SQL SELECT statements.

Since:
8.0.0
  • Constructor Details

  • Method Details

    • addClause

      public void addClause(I_CmsQueryFragment clause)
      Adds another clause to the query.

      Parameters:
      clause - the clause to add
    • addColumn

      public void addColumn(I_CmsQueryFragment node)
      Adds an expression which should be added as a column in the result set.

      Parameters:
      node - the expression which should be added as a column
    • addColumn

      public void addColumn(String column)
      Adds an expression which should be added as a column in the result set.

      Parameters:
      column - the expression which should be added as a column
    • addCondition

      public void addCondition(I_CmsQueryFragment node)
      Adds a new condition to the query.

      Parameters:
      node - the condition to add to the query
    • addCondition

      public void addCondition(String fragment, Object... params)
      Adds a new condition to the query.

      Parameters:
      fragment - the condition SQL
      params - the condition parameters
    • addTable

      public void addTable(String table)
      Adds a table to the query's FROM clause.

      Parameters:
      table - the table to add
    • addTable

      public CmsSelectQuery.TableAlias addTable(String table, String aliasPrefix)
      Adds a table the query's FROM clause.

      Parameters:
      table - the table to add
      aliasPrefix - the prefix used to generate the alias
      Returns:
      an alias for the table
    • getOrdering

      Returns the fragment for the ORDER BY clause.

      Returns:
      the fragment for the ORDER BY clause
    • setOrdering

      public void setOrdering(String ordering)
      Sets the SQL used for the ORDER BY clause.

      Parameters:
      ordering - the SQL used for the ORDER BY clause
    • visit

      public void visit(CmsStatementBuilder builder)
      Description copied from interface: I_CmsQueryFragment
      Generates the SQL and parameters and sends them to the statement builder .

      Specified by:
      visit in interface I_CmsQueryFragment
      Parameters:
      builder - the statement builder
      See Also: