@PublicEvolving public interface JdbcDialect extends Serializable
JdbcDialectFactory
Modifier and Type | Method and Description |
---|---|
default String |
appendDefaultUrlProperties(String url)
Appends default JDBC properties to url for current dialect.
|
default Optional<String> |
defaultDriverName() |
String |
dialectName()
Get the name of jdbc dialect.
|
String |
getDeleteStatement(String tableName,
String[] conditionFields)
Constructs the dialects delete statement for a single row with the given condition.
|
String |
getInsertIntoStatement(String tableName,
String[] fieldNames)
Generates a string that will be used as a
PreparedStatement to insert a row
into a database table. |
String |
getLimitClause(long limit)
Get limit clause to limit the number of emitted row from the jdbc source.
|
JdbcRowConverter |
getRowConverter(RowType rowType)
Get converter that convert jdbc object and Flink internal object each other.
|
String |
getRowExistsStatement(String tableName,
String[] conditionFields)
Generates a query to determine if a row exists in the table.
|
String |
getSelectFromStatement(String tableName,
String[] selectFields,
String[] conditionFields)
Constructs the dialects select statement for fields with given conditions.
|
String |
getUpdateStatement(String tableName,
String[] fieldNames,
String[] conditionFields)
Constructs the dialects update statement for a single row with the given condition.
|
Optional<String> |
getUpsertStatement(String tableName,
String[] fieldNames,
String[] uniqueKeyFields)
Constructs the dialects upsert statement if supported; such as MySQL's
DUPLICATE KEY
UPDATE , or PostgreSQL's {@code ON CONFLICT... |
String |
quoteIdentifier(String identifier)
Quotes the identifier.
|
void |
validate(RowType rowType)
Check if this dialect instance support a specific data type in table schema.
|
String dialectName()
JdbcRowConverter getRowConverter(RowType rowType)
rowType
- the given row typeString getLimitClause(long limit)
limit
- number of row to emit. The value of the parameter should be non-negative.void validate(RowType rowType) throws ValidationException
rowType
- the physical table datatype of a row in the database table.ValidationException
- in case of the table schema contains unsupported type.default Optional<String> defaultDriverName()
String quoteIdentifier(String identifier)
Used to put quotes around the identifier if the column name is a reserved keyword or contains characters requiring quotes (e.g., space).
Optional<String> getUpsertStatement(String tableName, String[] fieldNames, String[] uniqueKeyFields)
DUPLICATE KEY
UPDATE
, or PostgreSQL's ON CONFLICT... DO UPDATE SET..
. If supported, the returned
string will be used as a PreparedStatement
. Fields in the statement must be
in the same order as the fieldNames
parameter.
If the dialect does not support native upsert statements, the writer will fallback to
SELECT
+ UPDATE
/INSERT
which may have poor performance.
String getRowExistsStatement(String tableName, String[] conditionFields)
PreparedStatement
.
By default, the dialect will fallback to a simple SELECT
query.
String getInsertIntoStatement(String tableName, String[] fieldNames)
PreparedStatement
to insert a row
into a database table. Fields in the statement must be in the same order as the fieldNames
parameter.INSERT INTO
statement.String getUpdateStatement(String tableName, String[] fieldNames, String[] conditionFields)
PreparedStatement
. Fields in the statement
must be in the same order as the fieldNames
parameter.String getDeleteStatement(String tableName, String[] conditionFields)
PreparedStatement
. Fields in the statement
must be in the same order as the fieldNames
parameter.String getSelectFromStatement(String tableName, String[] selectFields, String[] conditionFields)
PreparedStatement
. Fields in the statement must be
in the same order as the fieldNames
parameter.default String appendDefaultUrlProperties(String url)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.