Package org.opencms.db
Class CmsSelectQuery
java.lang.Object
org.opencms.db.CmsSelectQuery
- All Implemented Interfaces:
I_CmsQueryFragment
A class for generating SQL SELECT statements.
- Since:
- 8.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Helper class which wraps a table alias. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClause
(I_CmsQueryFragment clause) Adds another clause to the query.void
Adds an expression which should be added as a column in the result set.void
addColumn
(I_CmsQueryFragment node) Adds an expression which should be added as a column in the result set.void
addCondition
(String fragment, Object... params) Adds a new condition to the query.void
Adds a new condition to the query.void
Adds a table to the query's FROM clause.Adds a table the query's FROM clause.Returns the fragment for the ORDER BY clause.void
setOrdering
(String ordering) Sets the SQL used for the ORDER BY clause.void
visit
(CmsStatementBuilder builder) Generates the SQL and parameters and sends them to the statement builder .
-
Constructor Details
-
CmsSelectQuery
public CmsSelectQuery()Creates a new instance.
-
-
Method Details
-
addClause
Adds another clause to the query.- Parameters:
clause
- the clause to add
-
addColumn
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
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
Adds a new condition to the query.- Parameters:
node
- the condition to add to the query
-
addCondition
Adds a new condition to the query.- Parameters:
fragment
- the condition SQLparams
- the condition parameters
-
addTable
Adds a table to the query's FROM clause.- Parameters:
table
- the table to add
-
addTable
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
Returns the fragment for the ORDER BY clause.- Returns:
- the fragment for the ORDER BY clause
-
setOrdering
Sets the SQL used for the ORDER BY clause.- Parameters:
ordering
- the SQL used for the ORDER BY clause
-
visit
Description copied from interface:I_CmsQueryFragment
Generates the SQL and parameters and sends them to the statement builder .- Specified by:
visit
in interfaceI_CmsQueryFragment
- Parameters:
builder
- the statement builder- See Also:
-