Module litebridge.db.spi.impl
Class FunctionExpression
java.lang.Object
org.litebridgedb.db.spi.expression.ColumnExpressionImpl
org.litebridgedb.db.spi.expression.DelegateColumnExpression
org.litebridgedb.db.spi.impl.function.AliasedDelegateColumnExpression
org.litebridgedb.db.spi.impl.function.FunctionExpression
- All Implemented Interfaces:
ColumnExpression,DelegateExpression,SelectExpression
Base class for function expressions operating on a column.
-
Field Summary
Fields inherited from class org.litebridgedb.db.spi.impl.function.AliasedDelegateColumnExpression
columnIdentifierGeneratorFields inherited from class org.litebridgedb.db.spi.expression.DelegateColumnExpression
targetFields inherited from class org.litebridgedb.db.spi.expression.ColumnExpressionImpl
column -
Constructor Summary
ConstructorsConstructorDescriptionFunctionExpression(ColumnExpression target, ColumnIdentifierGenerator columnIdentifierGenerator) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringprepareSql(Operation operation, boolean alias) Prepare SQL representation of the function.protected abstract Stringtemplate()Gets the template for the SQL representation of the function.Creates a SQL representation of the expression.toSqlWithAlias(Operation operation) Creates a SQL representation of the expression, specifically including any required aliases.Methods inherited from class org.litebridgedb.db.spi.impl.function.AliasedDelegateColumnExpression
id, idWithAlias, localIdMethods inherited from class org.litebridgedb.db.spi.expression.DelegateColumnExpression
column, target
-
Constructor Details
-
FunctionExpression
public FunctionExpression(ColumnExpression target, ColumnIdentifierGenerator columnIdentifierGenerator) Constructor.- Parameters:
target- Target column expression to encapsulate.columnIdentifierGenerator- Database provider-specific column identifier generator.
-
-
Method Details
-
toSql
Creates a SQL representation of the expression.This is usually used for expressions that do not require any aliases.
- Specified by:
toSqlin interfaceSelectExpression- Overrides:
toSqlin classAliasedDelegateColumnExpression- Parameters:
operation- the operation that is being executed- Returns:
- the SQL representation of the expression
-
toSqlWithAlias
Creates a SQL representation of the expression, specifically including any required aliases.- Overrides:
toSqlWithAliasin classAliasedDelegateColumnExpression- Parameters:
operation- the operation that is being executed- Returns:
- the SQL representation of the expression
-
prepareSql
Prepare SQL representation of the function.- Parameters:
operation- The operation that is being executedalias- Whether to alias the SQL function result- Returns:
- SQL representation of the function
-
template
Gets the template for the SQL representation of the function.The template should contain a single "%s" placeholder for the column identifier.
- Returns:
- SQL representation template
-