public class FunctionCall extends Expression
"<name>([<param1>, ... <paramN>]) [OVER (<window>)]"
.EMPTY
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Constructor and Description |
---|
FunctionCall(Function function) |
FunctionCall(Object functionNameStr)
|
Modifier and Type | Method and Description |
---|---|
FunctionCall |
addColumnParams(Column... columns)
Adds column parameters to the function call as
"<alias>.<column>" . |
FunctionCall |
addCustomParams(Object... params)
Adds custom parameters to the function call.
|
FunctionCall |
addNumericValueParam(Object obj)
Adds a numeric value parameter to the function call.
|
protected void |
appendCustomIfNotNull(AppendableExt app,
SqlObject obj)
Appends the given custom clause to the given AppendableExt, handling
null and enclosing parens. |
protected void |
appendNestedClauses(AppendableExt app,
SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Appends the given nested clauses to the given AppendableExt, handling
empty nested clauses and enclosing parens.
|
void |
appendTo(AppendableExt app)
Appends this object to the given AppendableExt.
|
protected static boolean |
areEmpty(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Determines if any of the given clauses are non-empty.
|
static FunctionCall |
avg()
Convenience method for generating a FunctionCall using the standard AVG
function.
|
protected void |
closeParen(AppendableExt app)
Appends a close parenthesis to the given AppendableExt if disableParens is
true , otherwise does nothing. |
protected void |
collectSchemaObjects(ValidationContext vContext)
Used during Query.validate() calls to collect the dbschema objects
referenced in a query.
|
static FunctionCall |
count()
Convenience method for generating a FunctionCall using the standard COUNT
function.
|
static FunctionCall |
countAll()
Convenience method for generating a FunctionCall using the standard COUNT
function with the single parameter '*'.
|
static FunctionCall |
denseRank()
Convenience method for generating a FunctionCall using the DENSE_RANK
aggregate function.
|
boolean |
hasParens()
Returns
true iff the output of this instance would include
surrounding parentheses, false otherwise. |
protected static boolean |
hasParens(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
Determines if any of the given clauses are non-empty.
|
boolean |
isDisableParens()
Returns whether or not wrapping parentheses are disabled for this clause
(for clauses which utilize wrapping parentheses).
|
boolean |
isEmpty()
Returns
true iff the output of this instance would be an
empty expression, false otherwise. |
static FunctionCall |
max()
Convenience method for generating a FunctionCall using the standard MAX
function.
|
static FunctionCall |
min()
Convenience method for generating a FunctionCall using the standard MIN
function.
|
protected void |
openParen(AppendableExt app)
Appends an open parenthesis to the given AppendableExt if disableParens is
true , otherwise does nothing. |
static FunctionCall |
rank()
Convenience method for generating a FunctionCall using the RANK
aggregate function.
|
static FunctionCall |
rowNumber()
Convenience method for generating a FunctionCall using the ROW_NUMBER
aggregate function.
|
FunctionCall |
setIsDistinct(boolean isDistinct)
Iff isDistinct is
true , adds the DISTINCT keyword to the
parameter clause |
FunctionCall |
setWindow(Object window)
Sets the window clause for this function call, like
"OVER (<windowClause>)" . |
FunctionCall |
setWindowByName(String windowName)
Sets the window clause for this function call to a reference to the named
window definition, like
"OVER <windowClauseName>" . |
static FunctionCall |
sum()
Convenience method for generating a FunctionCall using the standard SUM
function.
|
setDisableParens
collectSchemaObjects, doValidate, toString
toString, toString
public FunctionCall(Function function)
public FunctionCall(Object functionNameStr)
public boolean hasParens()
true
iff the output of this instance would include
surrounding parentheses, false
otherwise.
Default implementation returns !isEmpty() && !isDisableParens()
.
public FunctionCall setIsDistinct(boolean isDistinct)
true
, adds the DISTINCT keyword to the
parameter clausepublic FunctionCall addCustomParams(Object... params)
Object
-> SqlObject
conversions handled by
Converter.COLUMN_VALUE_TO_OBJ
.
public FunctionCall addColumnParams(Column... columns)
"<alias>.<column>"
.public FunctionCall addNumericValueParam(Object obj)
Object
-> SqlObject
conversions handled by
Converter.COLUMN_VALUE_TO_OBJ
.
public FunctionCall setWindow(Object window)
"OVER (<windowClause>)"
.WindowDefinitionClause
public FunctionCall setWindowByName(String windowName)
"OVER <windowClauseName>"
.protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
collectSchemaObjects
in class SqlObject
vContext
- handle to the current validation contextpublic void appendTo(AppendableExt app) throws IOException
Appendee
appendTo
in interface Appendee
appendTo
in class AppendeeObject
app
- the AppendableExt to which this class should append itselfIOException
- if the append failspublic static FunctionCall avg()
public static FunctionCall min()
public static FunctionCall max()
public static FunctionCall sum()
public static FunctionCall count()
public static FunctionCall countAll()
public static FunctionCall rowNumber()
public static FunctionCall rank()
public static FunctionCall denseRank()
public boolean isDisableParens()
false
.public boolean isEmpty()
true
iff the output of this instance would be an
empty expression, false
otherwise.
Default implementation returns false
.
protected static boolean areEmpty(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
false
if at least one clause is non-empty, true
otherwiseprotected static boolean hasParens(SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses)
false
if at least one clause is non-empty, true
otherwiseprotected void openParen(AppendableExt app) throws IOException
true
, otherwise does nothing.IOException
protected void closeParen(AppendableExt app) throws IOException
true
, otherwise does nothing.IOException
protected void appendCustomIfNotNull(AppendableExt app, SqlObject obj) throws IOException
null
and enclosing parens.IOException
protected void appendNestedClauses(AppendableExt app, SqlObjectList<? extends com.healthmarketscience.sqlbuilder.NestableClause> nestedClauses) throws IOException
IOException
Copyright © 2006–2021 OpenHMS. All rights reserved.