@PublicEvolving public abstract class AbstractDialect extends Object implements JdbcDialect
JdbcDialects
that implements basic data type validation and
the construction of basic INSERT
, UPDATE
, DELETE
, and SELECT
statements.
Implementors should be careful to check the default SQL statements are performant for their specific dialect and override them if necessary.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractDialect.Range
A range from [min,max] where min <= max.
|
Constructor and Description |
---|
AbstractDialect() |
Modifier and Type | Method and Description |
---|---|
Optional<AbstractDialect.Range> |
decimalPrecisionRange() |
String |
getDeleteStatement(String tableName,
String[] conditionFields)
A simple single row
DELETE statement. |
String |
getInsertIntoStatement(String tableName,
String[] fieldNames)
A simple
INSERT INTO statement. |
String |
getRowExistsStatement(String tableName,
String[] conditionFields)
A simple
SELECT statement that checks for the existence of a single row. |
String |
getSelectFromStatement(String tableName,
String[] selectFields,
String[] conditionFields)
A simple
SELECT statement. |
String |
getUpdateStatement(String tableName,
String[] fieldNames,
String[] conditionFields)
A simple single row
UPDATE statement. |
abstract Set<LogicalTypeRoot> |
supportedTypes()
Defines the set of supported types for the dialect.
|
Optional<AbstractDialect.Range> |
timestampPrecisionRange() |
void |
validate(RowType rowType)
Check if this dialect instance support a specific data type in table schema.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendDefaultUrlProperties, defaultDriverName, dialectName, getLimitClause, getRowConverter, getUpsertStatement, quoteIdentifier
public void validate(RowType rowType) throws ValidationException
JdbcDialect
validate
in interface JdbcDialect
rowType
- the physical table datatype of a row in the database table.ValidationException
- in case of the table schema contains unsupported type.public String getInsertIntoStatement(String tableName, String[] fieldNames)
INSERT INTO
statement.
INSERT INTO table_name (column_name [, ...])
VALUES (value [, ...])
getInsertIntoStatement
in interface JdbcDialect
INSERT INTO
statement.public String getUpdateStatement(String tableName, String[] fieldNames, String[] conditionFields)
UPDATE
statement.
UPDATE table_name
SET col = val [, ...]
WHERE cond [AND ...]
getUpdateStatement
in interface JdbcDialect
public String getDeleteStatement(String tableName, String[] conditionFields)
DELETE
statement.
DELETE FROM table_name
WHERE cond [AND ...]
getDeleteStatement
in interface JdbcDialect
public String getSelectFromStatement(String tableName, String[] selectFields, String[] conditionFields)
SELECT
statement.
SELECT expression [, ...]
FROM table_name
WHERE cond [AND ...]
getSelectFromStatement
in interface JdbcDialect
public String getRowExistsStatement(String tableName, String[] conditionFields)
SELECT
statement that checks for the existence of a single row.
SELECT 1
FROM table_name
WHERE cond [AND ...]
getRowExistsStatement
in interface JdbcDialect
public Optional<AbstractDialect.Range> timestampPrecisionRange()
TimestampType
columns. None if timestamp type is not supported.public Optional<AbstractDialect.Range> decimalPrecisionRange()
DecimalType
columns. None if decimal type is not supported.public abstract Set<LogicalTypeRoot> supportedTypes()
DECIMAL
or TIMESTAMP
types, be sure to override decimalPrecisionRange()
and timestampPrecisionRange()
respectively.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.