Module litebridge.db.spi.impl
Class SqlFunctionRegistryFactory
java.lang.Object
org.litebridge.db.spi.impl.expression.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 LabelGeneratorAlias/identifier SQL fragment generatorprotected final SelectSqlGeneratorThe select SQL generator. -
Constructor Summary
ConstructorsConstructorDescriptionSqlFunctionRegistryFactory(LabelGenerator labelGenerator, SelectSqlGenerator selectSqlGenerator) Constructs a newSqlFunctionRegistryFactory. -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates a SQL function registry for this database provider.protected DelegateExpressioncreateAbs(SelectExpression target, Object... args) Creates an ABS-implementing expression.protected AliasReferencecreateAliasReference(String alias, @Nullable String tableAlias) Creates an alias reference expression.protected DelegateExpressioncreateAvg(SelectExpression target, Object... args) Creates an AVG-implementing expression.protected BindValueExpressionImplcreateBindValue(int index, int size, ColumnType columnType, @Nullable String alias) Creates a bind value expression.protected DelegateExpressioncreateCast(SelectExpression target, Object... args) protected SelectExpressionCreates a COUNT-implementing expression.protected SelectExpressionCreates a CURRENT_TIMESTAMP-implementing expression.protected LiteralExpressionImplcreateLiteral(@Nullable Object value, @Nullable String alias) Creates a literal expression.protected DelegateExpressioncreateLower(SelectExpression target, Object... args) Creates a LOWER-implementing expression.protected DelegateExpressioncreateMax(SelectExpression target, Object... args) Creates an MAX-implementing expression.protected DelegateExpressioncreateMin(SelectExpression target, Object... args) Creates an MIN-implementing expression.protected SelectColumncreateSelectColumn(Column column, @Nullable String alias, @Nullable String tableAlias) Creates an expression to select a specific column.protected ColumnReferencecreateSelectReference(Column column, @Nullable String alias, @Nullable String tableAlias) Creates a select reference expression.protected SubselectExpressioncreateSubselect(Select subselect) Creates a subselect expression.protected DelegateExpressioncreateSubstring(SelectExpression target, int start, @Nullable Integer length, @Nullable String alias) Creates a SUBSTRING-implementing expression.protected DelegateExpressioncreateSubstring(SelectExpression target, Object... args) Creates a SUBSTRING-implementing expression.protected DelegateExpressioncreateUpper(SelectExpression delegate, Object... args) Creates an UPPER-implementing expression.
-
Field Details
-
labelGenerator
Alias/identifier SQL fragment generator -
selectSqlGenerator
The select SQL generator.
-
-
Constructor Details
-
SqlFunctionRegistryFactory
public SqlFunctionRegistryFactory(LabelGenerator labelGenerator, SelectSqlGenerator selectSqlGenerator) Constructs a newSqlFunctionRegistryFactory.- Parameters:
labelGenerator- The database provider's column alias/identifier SQL fragment 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
protected SelectColumn createSelectColumn(Column column, @Nullable String alias, @Nullable String tableAlias) Creates an expression to select a specific column.- Parameters:
column- Target columnalias- Optional column alias- 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
-
createBindValue
protected BindValueExpressionImpl createBindValue(int index, int size, ColumnType columnType, @Nullable String alias) Creates a bind value expression.- Parameters:
index- Bind value index.size- Size of the bind value.alias- Alias for the bind value.- Returns:
- The bind value expression.
-
createSelectReference
protected ColumnReference createSelectReference(Column column, @Nullable String alias, @Nullable String tableAlias) Creates a select reference expression.- Parameters:
column- the column- Returns:
- the select reference expression
-
createAliasReference
Creates an alias reference expression.- Parameters:
alias- the column to referencetableAlias- the alias to select from- 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:
delegate- 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 DelegateExpression createSubstring(SelectExpression target, int start, @Nullable Integer length, @Nullable String alias) 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
-
createCast
-
createCurrentTimestamp
Creates a CURRENT_TIMESTAMP-implementing expression.- Returns:
- A CURRENT_TIMESTAMP-implementing expression
-