Package io.debezium.relational
Class Tables
java.lang.Object
io.debezium.relational.Tables
Structural definitions for a set of tables in a JDBC database.
- Author:
- Randall Hauch
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A filter for columns.static class
static interface
A filter for tables.private static class
A set of table ids.private static class
A map of tables by id. -
Field Summary
Modifier and TypeFieldDescriptionprivate final Tables.TableIds
private final FunctionalReadWriteLock
private final boolean
private final Tables.TablesById
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
clone()
editOrCreateTable
(TableId tableId) Obtain an editor for the table with the given ID.Obtain an editor for the table with the given ID.boolean
Obtain the definition of the identified table.Obtain the definition of the identified table.int
hashCode()
overwriteTable
(Table table) Add or update the definition for the identified table.overwriteTable
(TableId tableId, List<Column> columnDefs, List<String> primaryKeyColumnNames, String defaultCharsetName, List<Attribute> attributes) Add or update the definition for the identified table.removeTable
(TableId tableId) Remove the definition of the identified table.void
removeTablesForDatabase
(String schemaName) void
removeTablesForDatabase
(String catalogName, String schemaName) renameTable
(TableId existingTableId, TableId newTableId) Rename an existing table.int
size()
Get the number of tables that are in this object.subset
(Tables.TableFilter filter) tableIds()
Get the set ofTableId
s for which there is aSchema
.toString()
updateTable
(TableId tableId, Function<Table, Table> changer) Add or update the definition for the identified table.
-
Field Details
-
lock
-
tablesByTableId
-
changes
-
tableIdCaseInsensitive
private final boolean tableIdCaseInsensitive
-
-
Constructor Details
-
Tables
public Tables(boolean tableIdCaseInsensitive) Create an empty set of definitions.- Parameters:
tableIdCaseInsensitive
- - true if lookup is case insensitive (typical for MySQL on Windows)
-
Tables
public Tables()Create case sensitive empty set of definitions. -
Tables
-
-
Method Details
-
clear
public void clear() -
clone
-
size
public int size()Get the number of tables that are in this object.- Returns:
- the table count
-
drainChanges
-
overwriteTable
public Table overwriteTable(TableId tableId, List<Column> columnDefs, List<String> primaryKeyColumnNames, String defaultCharsetName, List<Attribute> attributes) Add or update the definition for the identified table.- Parameters:
tableId
- the identifier of the tablecolumnDefs
- the list of column definitions; may not be null or emptyprimaryKeyColumnNames
- the list of the column names that make up the primary key; may be null or emptydefaultCharsetName
- the name of the character set that should be used by defaultattributes
- the list of attribute definitions; may not be null or empty- Returns:
- the previous table definition, or null if there was no prior table definition
-
overwriteTable
Add or update the definition for the identified table.- Parameters:
table
- the definition for the table; may not be null- Returns:
- the previous table definition, or null if there was no prior table definition
-
removeTablesForDatabase
-
removeTablesForDatabase
-
renameTable
Rename an existing table.- Parameters:
existingTableId
- the identifier of the existing table to be renamed; may not be nullnewTableId
- the new identifier for the table; may not be null- Returns:
- the previous table definition, or null if there was no prior table definition
-
updateTable
Add or update the definition for the identified table. -
removeTable
Remove the definition of the identified table.- Parameters:
tableId
- the identifier of the table- Returns:
- the existing table definition that was removed, or null if there was no prior table definition
-
forTable
Obtain the definition of the identified table.- Parameters:
tableId
- the identifier of the table- Returns:
- the table definition, or null if there was no definition for the identified table
-
forTable
Obtain the definition of the identified table.- Parameters:
catalogName
- the name of the database catalog that contains the table; may be null if the JDBC driver does not show a schema for this tableschemaName
- the name of the database schema that contains the table; may be null if the JDBC driver does not show a schema for this tabletableName
- the name of the table- Returns:
- the table definition, or null if there was no definition for the identified table
-
tableIds
Get the set ofTableId
s for which there is aSchema
.- Returns:
- the immutable set of table identifiers; never null
-
editTable
Obtain an editor for the table with the given ID. This method does not lock the set of table definitions, so use with caution. The resulting editor can be used to modify the table definition, but when completed the newTable
needs to be added back to this object viaoverwriteTable(Table)
.- Parameters:
tableId
- the identifier of the table- Returns:
- the editor for the table, or null if there is no table with the specified ID
-
editOrCreateTable
Obtain an editor for the table with the given ID. This method does not lock or modify the set of table definitions, so use with caution. The resulting editor can be used to modify the table definition, but when completed the newTable
needs to be added back to this object viaoverwriteTable(Table)
.- Parameters:
tableId
- the identifier of the table- Returns:
- the editor for the table, or null if there is no table with the specified ID
-
hashCode
public int hashCode() -
equals
-
subset
-
toString
-