public interface JdbcDialect extends Serializable
| 限定符和类型 | 字段和说明 |
|---|---|
static org.slf4j.Logger |
log |
| 限定符和类型 | 方法和说明 |
|---|---|
default Long |
approximateRowCntStatement(Connection connection,
JdbcSourceTable table)
Approximate total number of entries in the lookup table.
|
default void |
connectionUrlParse(String url,
Map<String,String> info,
Map<String,String> defaultParameter) |
default PreparedStatement |
creatPreparedStatement(Connection connection,
String queryTemplate,
int fetchSize)
Different dialects optimize their PreparedStatement
|
default Map<String,String> |
defaultParameter() |
String |
dialectName()
Get the name of jdbc dialect.
|
default String |
extractTableName(TablePath tablePath) |
default String |
getDeleteStatement(String database,
String tableName,
String[] conditionFields)
Constructs the dialects delete statement for a single row with the given condition.
|
default String |
getFieldIde(String identifier,
String fieldIde) |
default String |
getInsertIntoStatement(String database,
String tableName,
String[] fieldNames)
Constructs the dialects insert statement for a single row.
|
default JdbcConnectionProvider |
getJdbcConnectionProvider(JdbcConnectionConfig jdbcConnectionConfig) |
JdbcDialectTypeMapper |
getJdbcDialectTypeMapper()
get jdbc meta-information type to seatunnel data type mapper.
|
default ResultSetMetaData |
getResultSetMetaData(Connection conn,
String query) |
JdbcRowConverter |
getRowConverter()
Get converter that convert jdbc object to seatunnel internal object.
|
default String |
getRowExistsStatement(String database,
String tableName,
String[] conditionFields)
Generates a query to determine if a row exists in the table.
|
default String |
getUpdateStatement(String database,
String tableName,
String[] fieldNames,
String[] conditionFields,
boolean isPrimaryKeyUpdated)
Constructs the dialects update statement for a single row with the given condition.
|
Optional<String> |
getUpsertStatement(String database,
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... |
default String |
hashModForField(String fieldName,
int mod) |
default TablePath |
parse(String tablePath) |
default Object |
queryNextChunkMax(Connection connection,
JdbcSourceTable table,
String columnName,
int chunkSize,
Object includedLowerBound)
Query the maximum value of the next chunk, and the next chunk must be greater than or equal
to
includedLowerBound value [min_1, max_1), [min_2, max_2),... |
default String |
quoteDatabaseIdentifier(String identifier)
Quotes the identifier for database name or field name
|
default String |
quoteIdentifier(String identifier)
Quotes the identifier for table name or field name
|
default Object[] |
sampleDataFromColumn(Connection connection,
JdbcSourceTable table,
String columnName,
int samplingRate,
int fetchSize)
Performs a sampling operation on the specified column of a table in a JDBC-connected
database.
|
default String |
tableIdentifier(String database,
String tableName) |
default String |
tableIdentifier(TablePath tablePath) |
String dialectName()
JdbcRowConverter getRowConverter()
JdbcDialectTypeMapper getJdbcDialectTypeMapper()
default String quoteIdentifier(String identifier)
default String quoteDatabaseIdentifier(String identifier)
default String getInsertIntoStatement(String database, String tableName, String[] fieldNames)
PreparedStatement. Fields in the statement must be in the same order as
the fieldNames parameter.
INSERT INTO table_name (column_name [, ...]) VALUES (value [, ...])
INSERT INTO statement.default String getUpdateStatement(String database, String tableName, String[] fieldNames, String[] conditionFields, boolean isPrimaryKeyUpdated)
PreparedStatement. Fields in the statement
must be in the same order as the fieldNames parameter.
UPDATE table_name SET col = val [, ...] WHERE cond [AND ...]
UPDATE statement.default String getDeleteStatement(String database, String tableName, String[] conditionFields)
PreparedStatement. Fields in the statement
must be in the same order as the fieldNames parameter.
DELETE FROM table_name WHERE cond [AND ...]
DELETE statement.default String getRowExistsStatement(String database, String tableName, String[] conditionFields)
PreparedStatement.
SELECT 1 FROM table_name WHERE cond [AND ...]
QUERY statement.Optional<String> getUpsertStatement(String database, 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 ROW Exists + UPDATE/INSERT which may have poor performance.
UPSERT statement or Optional.empty().default PreparedStatement creatPreparedStatement(Connection connection, String queryTemplate, int fetchSize) throws SQLException
SQLExceptiondefault ResultSetMetaData getResultSetMetaData(Connection conn, String query) throws SQLException
SQLExceptiondefault void connectionUrlParse(String url, Map<String,String> info, Map<String,String> defaultParameter)
default Long approximateRowCntStatement(Connection connection, JdbcSourceTable table) throws SQLException
connection - The JDBC connection object used to connect to the database.table - table info.SQLExceptiondefault Object[] sampleDataFromColumn(Connection connection, JdbcSourceTable table, String columnName, int samplingRate, int fetchSize) throws SQLException
connection - The JDBC connection object used to connect to the database.table - The table in which the column resides.columnName - The name of the column to be sampled.samplingRate - samplingRate The inverse of the fraction of the data to be sampled from
the column. For example, a value of 1000 would mean 1/1000 of the data will be sampled.SQLException - If an SQL error occurs during the sampling operation.default Object queryNextChunkMax(Connection connection, JdbcSourceTable table, String columnName, int chunkSize, Object includedLowerBound) throws SQLException
includedLowerBound value [min_1, max_1), [min_2, max_2),... [min_n, null).
Each time this method is called it will return max1, max2...connection - JDBC connection.table - table info.columnName - column name.chunkSize - chunk size.includedLowerBound - the previous chunk end value.SQLExceptiondefault JdbcConnectionProvider getJdbcConnectionProvider(JdbcConnectionConfig jdbcConnectionConfig)
Copyright © 2024 The Apache Software Foundation. All rights reserved.