@PublicEvolving public interface JdbcDialect extends Serializable
JdbcDialectFactory| 限定符和类型 | 方法和说明 |
|---|---|
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(org.apache.flink.table.types.logical.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(org.apache.flink.table.types.logical.RowType rowType)
Check if this dialect instance support a specific data type in table schema.
|
String dialectName()
JdbcRowConverter getRowConverter(org.apache.flink.table.types.logical.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(org.apache.flink.table.types.logical.RowType rowType)
throws org.apache.flink.table.api.ValidationException
rowType - the physical table datatype of a row in the database table.org.apache.flink.table.api.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–2023 The Apache Software Foundation. All rights reserved.