Class SqlServerDialect
- java.lang.Object
-
- org.apache.flink.connector.jdbc.dialect.AbstractDialect
-
- org.apache.flink.connector.jdbc.databases.sqlserver.dialect.SqlServerDialect
-
- All Implemented Interfaces:
Serializable,JdbcDialect
@Internal public class SqlServerDialect extends AbstractDialect
JDBC dialect for SqlServer.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.connector.jdbc.dialect.AbstractDialect
AbstractDialect.Range
-
-
Constructor Summary
Constructors Constructor Description SqlServerDialect()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<AbstractDialect.Range>decimalPrecisionRange()The maximum precision is supported by decimal.Optional<String>defaultDriverName()StringdialectName()Get the name of jdbc dialect.StringgetLimitClause(long limit)Get limit clause to limit the number of emitted row from the jdbc source.JdbcRowConvertergetRowConverter(org.apache.flink.table.types.logical.RowType rowType)Get converter that convert jdbc object and Flink internal object each other.Optional<String>getUpsertStatement(String tableName, String[] fieldNames, String[] uniqueKeyFields)Constructs the dialects upsert statement if supported; such as MySQL'sDUPLICATE KEY UPDATE, or PostgreSQL'sON CONFLICT... DO UPDATE SET...StringquoteIdentifier(String identifier)Quotes the identifier.Set<org.apache.flink.table.types.logical.LogicalTypeRoot>supportedTypes()Defines the set of supported types for the dialect.Optional<AbstractDialect.Range>timestampPrecisionRange()The maximum precision is supported by datetime2.-
Methods inherited from class org.apache.flink.connector.jdbc.dialect.AbstractDialect
getDeleteStatement, getInsertIntoStatement, getRowExistsStatement, getSelectFromStatement, getUpdateStatement, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.connector.jdbc.dialect.JdbcDialect
appendDefaultUrlProperties
-
-
-
-
Method Detail
-
dialectName
public String dialectName()
Description copied from interface:JdbcDialectGet the name of jdbc dialect.- Returns:
- the dialect name.
-
timestampPrecisionRange
public Optional<AbstractDialect.Range> timestampPrecisionRange()
The maximum precision is supported by datetime2. https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime2-transact-sql?view=sql-server-ver16- Overrides:
timestampPrecisionRangein classAbstractDialect- Returns:
- The inclusive range [min,max] of supported precisions for
TimestampTypecolumns. None if timestamp type is not supported.
-
decimalPrecisionRange
public Optional<AbstractDialect.Range> decimalPrecisionRange()
The maximum precision is supported by decimal. https://docs.microsoft.com/en-us/sql/t-sql/data-types/precision-scale-and-length-transact-sql?view=sql-server-ver16- Overrides:
decimalPrecisionRangein classAbstractDialect- Returns:
- The inclusive range [min,max] of supported precisions for
DecimalTypecolumns. None if decimal type is not supported.
-
defaultDriverName
public Optional<String> defaultDriverName()
- Returns:
- the default driver class name, if user has not configured the driver class name, then this one will be used.
-
quoteIdentifier
public String quoteIdentifier(String identifier)
Description copied from interface:JdbcDialectQuotes the identifier.Used to put quotes around the identifier if the column name is a reserved keyword or contains characters requiring quotes (e.g., space).
- Returns:
- the quoted identifier.
-
getUpsertStatement
public Optional<String> getUpsertStatement(String tableName, String[] fieldNames, String[] uniqueKeyFields)
Description copied from interface:JdbcDialectConstructs the dialects upsert statement if supported; such as MySQL'sDUPLICATE KEY UPDATE, or PostgreSQL'sON CONFLICT... DO UPDATE SET... If supported, the returned string will be used as aPreparedStatement. Fields in the statement must be in the same order as thefieldNamesparameter.If the dialect does not support native upsert statements, the writer will fallback to
SELECT+UPDATE/INSERTwhich may have poor performance.- Returns:
- The upsert statement if supported, otherwise None.
-
getRowConverter
public JdbcRowConverter getRowConverter(org.apache.flink.table.types.logical.RowType rowType)
Description copied from interface:JdbcDialectGet converter that convert jdbc object and Flink internal object each other.- Parameters:
rowType- the given row type- Returns:
- a row converter for the database
-
getLimitClause
public String getLimitClause(long limit)
Description copied from interface:JdbcDialectGet limit clause to limit the number of emitted row from the jdbc source.- Parameters:
limit- number of row to emit. The value of the parameter should be non-negative.- Returns:
- the limit clause.
-
supportedTypes
public Set<org.apache.flink.table.types.logical.LogicalTypeRoot> supportedTypes()
Description copied from class:AbstractDialectDefines the set of supported types for the dialect. If the dialect supportsDECIMALorTIMESTAMPtypes, be sure to overrideAbstractDialect.decimalPrecisionRange()andAbstractDialect.timestampPrecisionRange()respectively.- Specified by:
supportedTypesin classAbstractDialect- Returns:
- a set of logical type roots.
-
-