public class Selects
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
ALIAS_REGEXP
An alias can only contain the characters a-z, A-Z or 0-9.
|
Constructor and Description |
---|
Selects() |
Modifier and Type | Method and Description |
---|---|
static Select |
expression(Expression e1,
java.lang.String alias)
Same as
expression(e1, alias, false) . |
static Select |
expression(Expression e1,
java.lang.String alias,
boolean useInDistinctCount)
Create a selection from an expression, optionally giving it an alias.
|
public static final java.util.regex.Pattern ALIAS_REGEXP
public static final Select expression(Expression e1, java.lang.String alias) throws InvalidDataException
expression(e1, alias, false)
.e1
- The expression to select. Null is not allowedalias
- The alias to give the expression. Only characters a-z, A-Z and 0-9 are allowed.
Null is allowed.InvalidDataException
- If the required parameter is null or
if illegal characters is used in alias
expression(Expression, String, boolean)
public static final Select expression(Expression e1, java.lang.String alias, boolean useInDistinctCount) throws InvalidDataException
SqlResultIterator.getIndex(String)
.
SELECT <expression> AS <alias> FROM ...
The useInDistinctCount parameter affects the Query.count(DbControl)
method, if the Query.setDistinct(boolean)
has been set to true. In this
case only expressions which has been created for use with the distinct function
are used in the selection list:
SELECT COUNT(DISTINCT <expression>) FROM ...
e1
- The expression to selectalias
- The alias to give the expressionuseInDistinctCount
- If the expression should be used when counting distinct valuesInvalidDataException
- If the expression is null or if the
alias contains invalid characters