Module litebridge.db.spi.impl
Class SqlFunctionRegistryFactory
java.lang.Object
org.litebridge.db.spi.impl.function.SqlFunctionRegistryFactory
Factory for creating
SqlFunctionRegistry instances.
This is meant to be easily overridden by different database providers, replacing specific expressions with database-specific alternatives.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ColumnIdentifierGeneratorThe column identifier generator.protected final SelectSqlGeneratorThe select SQL generator. -
Constructor Summary
ConstructorsConstructorDescriptionSqlFunctionRegistryFactory(ColumnIdentifierGenerator columnIdentifierGenerator, SelectSqlGenerator selectSqlGenerator) Constructs a newSqlFunctionRegistryFactory. -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates a SQL function registry for this database provider.protected DelegateColumnExpressioncreateAbs(ColumnExpression target, Object... args) Creates an ABS-implementing expression.protected DelegateColumnExpressioncreateAvg(ColumnExpression target, Object... args) Creates an AVG-implementing expression.protected SelectExpressionCreates a COUNT-implementing expression.protected SelectExpressionCreates a CURRENT_TIMESTAMP-implementing expression.protected LiteralExpressioncreateLiteral(@Nullable Object value) Creates a literal expression.protected DelegateColumnExpressioncreateLower(ColumnExpression target, Object... args) Creates a LOWER-implementing expression.protected DelegateColumnExpressioncreateMax(ColumnExpression target, Object... args) Creates an MAX-implementing expression.protected DelegateColumnExpressioncreateMin(ColumnExpression target, Object... args) Creates an MIN-implementing expression.protected SelectColumncreateSelectColumn(Column column, Object... args) Creates an expression to select a specific column.protected SelectReferencecreateSelectReference(Column column) Creates a select reference expression.protected SubselectExpressioncreateSubselect(Select subselect) Creates a subselect expression.protected DelegateColumnExpressioncreateSubstring(ColumnExpression target, int start, @Nullable Integer length) Creates a SUBSTRING-implementing expression.protected DelegateColumnExpressioncreateSubstring(ColumnExpression target, Object... args) Creates a SUBSTRING-implementing expression.protected DelegateColumnExpressioncreateUpper(ColumnExpression columnExpression, Object... args) Creates an UPPER-implementing expression.
-
Field Details
-
columnIdentifierGenerator
The column identifier generator. -
selectSqlGenerator
The select SQL generator.
-
-
Constructor Details
-
SqlFunctionRegistryFactory
public SqlFunctionRegistryFactory(ColumnIdentifierGenerator columnIdentifierGenerator, SelectSqlGenerator selectSqlGenerator) Constructs a newSqlFunctionRegistryFactory.- Parameters:
columnIdentifierGenerator- The database provider's column identifier generatorselectSqlGenerator- The database provider's select SQL generator
-
-
Method Details
-
create
Creates a SQL function registry for this database provider.- Returns:
- SQL function registry for the database provider
-
createSelectColumn
Creates an expression to select a specific column.- Parameters:
column- Target columnargs- Not used; empty array- Returns:
- Expression to select a specific column
-
createSubselect
Creates a subselect expression.- Parameters:
subselect- the select operation- Returns:
- the subselect expression
-
createLiteral
Creates a literal expression.- Parameters:
value- the literal value- Returns:
- the literal expression
-
createSelectReference
Creates a select reference expression.- Parameters:
column- the column- Returns:
- the select reference expression
-
createAvg
Creates an AVG-implementing expression.- Parameters:
target- Target expression to encapsulate.args- Not used; empty array- Returns:
- A AVG-implementing expression
-
createMin
Creates an MIN-implementing expression.- Parameters:
target- Target expression to encapsulate.args- Not used; empty array- Returns:
- A MIN-implementing expression
-
createMax
Creates an MAX-implementing expression.- Parameters:
target- Target expression to encapsulate.args- Not used; empty array- Returns:
- A MAX-implementing expression
-
createCount
Creates a COUNT-implementing expression.- Returns:
- A COUNT-implementing expression
-
createUpper
Creates an UPPER-implementing expression.- Parameters:
columnExpression- Target expression to encapsulate.args- Not used; empty array- Returns:
- An UPPER-implementing expression
-
createLower
Creates a LOWER-implementing expression.- Parameters:
target- Target expression to encapsulate.args- Not used; empty array- Returns:
- A LOWER-implementing expression
-
createSubstring
Creates a SUBSTRING-implementing expression.- Parameters:
target- Target expression to encapsulate.args- expression arguments; should be [int, Inteeger]- Returns:
- SUBSTRING-implementing expression
-
createSubstring
protected DelegateColumnExpression createSubstring(ColumnExpression target, int start, @Nullable Integer length) Creates a SUBSTRING-implementing expression.- Parameters:
target- Target expression to encapsulate.start- Start index (first character is 1)length- Substring length; may benull- Returns:
- SUBSTRING-implementing expression
-
createAbs
Creates an ABS-implementing expression.- Parameters:
target- Target expression to encapsulate.args- Not used; empty array- Returns:
- An ABS-implementing expression
-
createCurrentTimestamp
Creates a CURRENT_TIMESTAMP-implementing expression.- Returns:
- A CURRENT_TIMESTAMP-implementing expression
-