This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBZ-8016 Introduce
lowercase
and uppercase
naming strategies
- Loading branch information
Showing
5 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/io/debezium/connector/jdbc/naming/LowercaseColumnNamingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.connector.jdbc.naming; | ||
|
||
/** | ||
* The lower-case implementation of the {@link ColumnNamingStrategy} that simply returns the field's | ||
* name as the column name in the destination table but in all lower-case. | ||
* | ||
* @author Chris Cranford | ||
*/ | ||
public class LowercaseColumnNamingStrategy implements ColumnNamingStrategy { | ||
@Override | ||
public String resolveColumnName(String fieldName) { | ||
return fieldName.toLowerCase(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/io/debezium/connector/jdbc/naming/LowercaseTableNamingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.connector.jdbc.naming; | ||
|
||
import org.apache.kafka.connect.sink.SinkRecord; | ||
|
||
import io.debezium.connector.jdbc.JdbcSinkConnectorConfig; | ||
|
||
/** | ||
* A lower-case implementation of the {@link DefaultTableNamingStrategy} where the computed table name | ||
* will also be returned in all lower-case. | ||
* | ||
* @author Chris Cranford | ||
*/ | ||
public class LowercaseTableNamingStrategy extends DefaultTableNamingStrategy { | ||
@Override | ||
public String resolveTableName(JdbcSinkConnectorConfig config, SinkRecord record) { | ||
return super.resolveTableName(config, record).toLowerCase(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/io/debezium/connector/jdbc/naming/UppercaseColumnNamingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.connector.jdbc.naming; | ||
|
||
/** | ||
* The upper-case implementation of the {@link ColumnNamingStrategy} that simply returns the field's | ||
* name as the column name in the destination table but in all upper-case. | ||
* | ||
* @author Chris Cranford | ||
*/ | ||
public class UppercaseColumnNamingStrategy implements ColumnNamingStrategy { | ||
@Override | ||
public String resolveColumnName(String fieldName) { | ||
return fieldName.toUpperCase(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/io/debezium/connector/jdbc/naming/UppercaseTableNamingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.connector.jdbc.naming; | ||
|
||
import org.apache.kafka.connect.sink.SinkRecord; | ||
|
||
import io.debezium.connector.jdbc.JdbcSinkConnectorConfig; | ||
|
||
/** | ||
* An upper-case implementation of the {@link DefaultTableNamingStrategy} where the computed table name | ||
* will also be returned in all upper-case. | ||
* | ||
* @author Chris Cranford | ||
*/ | ||
public class UppercaseTableNamingStrategy extends DefaultTableNamingStrategy { | ||
@Override | ||
public String resolveTableName(JdbcSinkConnectorConfig config, SinkRecord record) { | ||
return super.resolveTableName(config, record).toUpperCase(); | ||
} | ||
} |