Package org.opencms.db
Class CmsSelectQuery
- java.lang.Object
-
- org.opencms.db.CmsSelectQuery
-
- All Implemented Interfaces:
I_CmsQueryFragment
public class CmsSelectQuery extends java.lang.Object implements I_CmsQueryFragment
A class for generating SQL SELECT statements.- Since:
- 8.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCmsSelectQuery.TableAliasHelper class which wraps a table alias.
-
Constructor Summary
Constructors Constructor Description CmsSelectQuery()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClause(I_CmsQueryFragment clause)Adds another clause to the query.voidaddColumn(java.lang.String column)Adds an expression which should be added as a column in the result set.voidaddColumn(I_CmsQueryFragment node)Adds an expression which should be added as a column in the result set.voidaddCondition(java.lang.String fragment, java.lang.Object... params)Adds a new condition to the query.voidaddCondition(I_CmsQueryFragment node)Adds a new condition to the query.voidaddTable(java.lang.String table)Adds a table to the query's FROM clause.CmsSelectQuery.TableAliasaddTable(java.lang.String table, java.lang.String aliasPrefix)Adds a table the query's FROM clause.I_CmsQueryFragmentgetOrdering()Returns the fragment for the ORDER BY clause.voidsetOrdering(java.lang.String ordering)Sets the SQL used for the ORDER BY clause.voidvisit(CmsStatementBuilder builder)Generates the SQL and parameters and sends them to the statement builder .
-
-
-
Constructor Detail
-
CmsSelectQuery
public CmsSelectQuery()
Creates a new instance.
-
-
Method Detail
-
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(java.lang.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(java.lang.String fragment, java.lang.Object... params)
Adds a new condition to the query.- Parameters:
fragment- the condition SQLparams- the condition parameters
-
addTable
public void addTable(java.lang.String table)
Adds a table to the query's FROM clause.- Parameters:
table- the table to add
-
addTable
public CmsSelectQuery.TableAlias addTable(java.lang.String table, java.lang.String aliasPrefix)
Adds a table the query's FROM clause.- Parameters:
table- the table to addaliasPrefix- the prefix used to generate the alias- Returns:
- an alias for the table
-
getOrdering
public I_CmsQueryFragment getOrdering()
Returns the fragment for the ORDER BY clause.- Returns:
- the fragment for the ORDER BY clause
-
setOrdering
public void setOrdering(java.lang.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_CmsQueryFragmentGenerates the SQL and parameters and sends them to the statement builder .- Specified by:
visitin interfaceI_CmsQueryFragment- Parameters:
builder- the statement builder- See Also:
I_CmsQueryFragment.visit(org.opencms.db.CmsStatementBuilder)
-
-