use of io.debezium.relational.TableId in project debezium by debezium.
the class DdlParserSql2003 method parseCreateTable.
protected void parseCreateTable(Marker start) {
tokens.canConsumeAnyOf("GLOBAL", "LOCAL", "TEMPORARY");
tokens.consume("TABLE");
TableId tableId = parseQualifiedTableName(start);
TableEditor table = databaseTables.editOrCreateTable(tableId);
if (tokens.matches('(')) {
// Is either a subquery clause preceded by column name list, or table element list...
Marker tableContentStart = tokens.mark();
try {
parseAsSubqueryClause(start, table);
} catch (ParsingException e) {
tokens.rewind(tableContentStart);
parseTableElementList(start, table);
}
} else if (tokens.canConsume("OF")) {
// Read the qualified name ...
parseSchemaQualifiedName(start);
if (tokens.canConsume("UNDER")) {
// parent table name ...
parseSchemaQualifiedName(start);
}
if (tokens.matches('(')) {
parseTableElementList(start, table);
}
} else if (tokens.canConsume("AS")) {
parseAsSubqueryClause(start, table);
}
if (tokens.canConsume("ON", "COMMIT")) {
tokens.canConsume("PRESERVE");
tokens.canConsume("DELETE");
tokens.consume("ROWS");
}
// Update the table definition ...
databaseTables.overwriteTable(table.create());
signalCreateTable(tableId, start);
}
use of io.debezium.relational.TableId in project debezium by debezium.
the class DdlParserSql2003 method parseCreateView.
protected void parseCreateView(Marker start) {
tokens.canConsume("RECURSIVE");
tokens.consume("VIEW");
TableId tableId = parseQualifiedTableName(start);
if (skipViews) {
// We don't care about the rest ...
consumeRemainingStatement(start);
signalCreateTable(tableId, start);
debugSkipped(start);
return;
}
TableEditor table = databaseTables.editOrCreateTable(tableId);
List<String> columnNames = null;
if (tokens.canConsume("OF")) {
// Read the qualified name ...
parseSchemaQualifiedName(start);
if (tokens.canConsume("UNDER")) {
// parent table name ...
parseSchemaQualifiedName(start);
}
if (tokens.matches('(')) {
columnNames = parseColumnNameList(start);
}
} else if (tokens.matches('(')) {
columnNames = parseColumnNameList(start);
}
tokens.canConsume("AS");
// We don't care about the rest ...
consumeRemainingStatement(start);
if (columnNames != null) {
// We know nothing other than the names ...
columnNames.forEach(name -> {
table.addColumn(Column.editor().name(name).create());
});
}
// Update the table definition ...
databaseTables.overwriteTable(table.create());
signalCreateView(tableId, start);
}
use of io.debezium.relational.TableId in project debezium by debezium.
the class DdlParserSql2003 method parseDropTable.
protected void parseDropTable(Marker start) {
tokens.canConsume("TEMPORARY");
tokens.consume("TABLE");
tokens.canConsume("IF", "EXISTS");
TableId tableId = parseQualifiedTableName(start);
databaseTables.removeTable(tableId);
// ignore the rest ...
consumeRemainingStatement(start);
signalDropTable(tableId, start);
}
Aggregations