Class MySqlDatabaseDialect
java.lang.Object
io.debezium.connector.jdbc.dialect.GeneralDatabaseDialect
io.debezium.connector.jdbc.dialect.mysql.MySqlDatabaseDialect
- All Implemented Interfaces:
DatabaseDialect
- Direct Known Subclasses:
MariaDbDatabaseDialect
A
DatabaseDialect implementation for MySQL.- Author:
- Chris Cranford
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMySqlDatabaseDialect(JdbcSinkConnectorConfig config, org.hibernate.SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddColumnDefaultValue(SinkRecordDescriptor.FieldDescriptor field, StringBuilder columnSpec) Gets the prefix used before adding column-clauses inALTER TABLEstatements.protected StringFormat a date and time.getFormattedTime(TemporalAccessor value) Format a time.Format a timestamp.Format a timestamp with time zone.intGets the maximum length of a VARCHAR field in a primary key column.getUpsertStatement(TableDescriptor table, SinkRecordDescriptor record) Construct aUPSERTstatement specific for this dialect.booleanReturns whether the user has specified a time zone JDBC property or whether the connector configuration propertydatabase.time_zonehas been specified.protected voidbooleanReturns whether a time with time zone details be bound using the database time zone.Methods inherited from class io.debezium.connector.jdbc.dialect.GeneralDatabaseDialect
bindValue, columnNameFromField, columnNameFromField, columnQueryBindingFromField, getAlterTableColumnDelimiter, getAlterTableColumnPrefix, getAlterTableColumnSuffix, getAlterTableStatement, getAlterTableSuffix, getByteArrayFormat, getColumnNamingStrategy, getConfig, getCreateTableStatement, getDatabaseTimeZone, getDatabaseVersion, getDefaultDecimalPrecision, getDefaultTimestampPrecision, getDeleteStatement, getFormattedBoolean, getFormattedDate, getFormattedDateTimeWithNanos, getFormattedTimeWithTimeZone, getIdentifierHelper, getInsertStatement, getMaxNVarcharLengthInKey, getMaxVarbinaryLength, getQualifiedTableName, getQueryBindingWithValueCast, getSchemaType, getTableId, getTruncateStatement, getTypeName, getTypeName, getTypeName, getUpdateStatement, getVersion, isIdentifierUppercaseWhenNotQuoted, isNegativeScaleAllowed, readTable, registerType, resolveColumnName, resolveColumnNameFromField, resolveMissingFields, tableExists, toIdentifier, toIdentifierMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.connector.jdbc.dialect.DatabaseDialect
getMaxTimePrecision, getMaxTimestampPrecision, getTimeQueryBinding
-
Field Details
-
NO_DEFAULT_VALUE_TYPES
-
ISO_LOCAL_DATE_TIME_WITH_SPACE
-
connectionTimeZoneSet
private final boolean connectionTimeZoneSet
-
-
Constructor Details
-
MySqlDatabaseDialect
protected MySqlDatabaseDialect(JdbcSinkConnectorConfig config, org.hibernate.SessionFactory sessionFactory)
-
-
Method Details
-
getDatabaseTimeZoneQuery
- Overrides:
getDatabaseTimeZoneQueryin classGeneralDatabaseDialect
-
getDatabaseTimeZoneQueryResult
- Overrides:
getDatabaseTimeZoneQueryResultin classGeneralDatabaseDialect- Throws:
SQLException
-
isTimeZoneSet
public boolean isTimeZoneSet()Description copied from interface:DatabaseDialectReturns whether the user has specified a time zone JDBC property or whether the connector configuration propertydatabase.time_zonehas been specified.- Specified by:
isTimeZoneSetin interfaceDatabaseDialect- Overrides:
isTimeZoneSetin classGeneralDatabaseDialect- Returns:
- true if the properties have been specified; false otherwise.
-
shouldBindTimeWithTimeZoneAsDatabaseTimeZone
public boolean shouldBindTimeWithTimeZoneAsDatabaseTimeZone()Description copied from interface:DatabaseDialectReturns whether a time with time zone details be bound using the database time zone.- Specified by:
shouldBindTimeWithTimeZoneAsDatabaseTimeZonein interfaceDatabaseDialect- Overrides:
shouldBindTimeWithTimeZoneAsDatabaseTimeZonein classGeneralDatabaseDialect- Returns:
- true if the value should be shifted; false otherwise (the default).
-
registerTypes
protected void registerTypes()- Overrides:
registerTypesin classGeneralDatabaseDialect
-
getMaxVarcharLengthInKey
public int getMaxVarcharLengthInKey()Description copied from interface:DatabaseDialectGets the maximum length of a VARCHAR field in a primary key column.- Specified by:
getMaxVarcharLengthInKeyin interfaceDatabaseDialect- Overrides:
getMaxVarcharLengthInKeyin classGeneralDatabaseDialect- Returns:
- maximum varchar field length when participating in the primary key
-
getFormattedTime
Description copied from interface:DatabaseDialectFormat a time.- Specified by:
getFormattedTimein interfaceDatabaseDialect- Overrides:
getFormattedTimein classGeneralDatabaseDialect- Parameters:
value- the value to be formatted, nevernull- Returns:
- the formatted string value
-
getFormattedDateTime
Description copied from interface:DatabaseDialectFormat a date and time.- Specified by:
getFormattedDateTimein interfaceDatabaseDialect- Overrides:
getFormattedDateTimein classGeneralDatabaseDialect- Parameters:
value- the value to be formatted, nevernull- Returns:
- the formatted string value
-
getFormattedTimestamp
Description copied from interface:DatabaseDialectFormat a timestamp.- Specified by:
getFormattedTimestampin interfaceDatabaseDialect- Overrides:
getFormattedTimestampin classGeneralDatabaseDialect- Parameters:
value- the value to be formatted, nevernull- Returns:
- the formatted string value
-
getFormattedTimestampWithTimeZone
Description copied from interface:DatabaseDialectFormat a timestamp with time zone.- Specified by:
getFormattedTimestampWithTimeZonein interfaceDatabaseDialect- Overrides:
getFormattedTimestampWithTimeZonein classGeneralDatabaseDialect- Parameters:
value- the value to be formatted, nevernull- Returns:
- the formatted string value.
-
getAlterTablePrefix
Description copied from interface:DatabaseDialectGets the prefix used before adding column-clauses inALTER TABLEstatements.- Specified by:
getAlterTablePrefixin interfaceDatabaseDialect- Overrides:
getAlterTablePrefixin classGeneralDatabaseDialect- Returns:
- the alter table column-clauses prefix
-
getUpsertStatement
Description copied from interface:DatabaseDialectConstruct aUPSERTstatement specific for this dialect.- Specified by:
getUpsertStatementin interfaceDatabaseDialect- Overrides:
getUpsertStatementin classGeneralDatabaseDialect- Parameters:
table- the current relational table model, should not benullrecord- the current sink record being processed, should not benull- Returns:
- the upsert SQL statement to be executed, never
null
-
addColumnDefaultValue
protected void addColumnDefaultValue(SinkRecordDescriptor.FieldDescriptor field, StringBuilder columnSpec) - Overrides:
addColumnDefaultValuein classGeneralDatabaseDialect
-