java.lang.Object
org.litebridge.db.spi.impl.ColumnIdentifierGenerator
- Direct Known Subclasses:
OracleColumnIdentifierGenerator
The ColumnIdentifierGenerator class provides utilities for generating SQL column identifiers
with optional table qualifiers, handling reserved keywords, and creating aliases for columns.
This class can be extended to implement database-specific customizations of column identifier generation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateAliasDeclaration(String alias) Creates a SQL alias declaration.createColumnRef(Column column, Operation operation, ClauseType clause) Creates a SQL reference to a column.createSelectColumn(Column column, Operation operation, ClauseType clause, boolean nested) Creates a SQL identifier for a column to be used in a SELECT clause.quoteIdentifier(String identifier) Quotes a SQL identifier if it is a reserved word.
-
Constructor Details
-
ColumnIdentifierGenerator
public ColumnIdentifierGenerator()
-
-
Method Details
-
createSelectColumn
public String createSelectColumn(Column column, Operation operation, ClauseType clause, boolean nested) Creates a SQL identifier for a column to be used in a SELECT clause.- Parameters:
column- the column for which to create the identifieroperation- the current database operationclause- the SQL clause where the identifier will be usednested- whether the column is part of a nested expression- Returns:
- the generated SQL column identifier
-
createColumnRef
Creates a SQL reference to a column.- Parameters:
column- the column to referenceoperation- the current database operationclause- the SQL clause where the reference will be used- Returns:
- the generated SQL column reference
-
quoteIdentifier
Quotes a SQL identifier if it is a reserved word.- Parameters:
identifier- the identifier to potentially quote- Returns:
- the quoted (if necessary) or original identifier
-
createAliasDeclaration
Creates a SQL alias declaration.- Parameters:
alias- the alias to declare- Returns:
- the SQL alias declaration (e.g., "AS alias")
-