/** * Use the supplied table editor to create columns for the supplied result set. * * @param resultSet the query result set; may not be null * @param editor the consumer of the definitions; may not be null * @throws SQLException if an error occurs while using the result set */ public static void columnsFor(ResultSet resultSet, TableEditor editor) throws SQLException { List<Column> columns = new ArrayList<>(); columnsFor(resultSet, columns::add); editor.setColumns(columns); }
@Override public TableEditor edit() { return new TableEditorImpl().tableId(id) .setColumns(columnDefs) .setPrimaryKeyNames(pkColumnNames) .setDefaultCharsetName(defaultCharsetName); } }
private Table tableFromFromMessage(List<ReplicationMessage.Column> columns, Table table) { return table.edit() .setColumns(columns.stream() .map(column -> { final PostgresType type = column.getType(); final ColumnEditor columnEditor = Column.editor() .name(column.getName()) .jdbcType(type.getJdbcId()) .type(type.getName()) .optional(column.isOptional()) .nativeType(type.getOid()); columnEditor.length(column.getTypeMetadata().getLength()); columnEditor.scale(column.getTypeMetadata().getScale()); return columnEditor.create(); }) .collect(Collectors.toList()) ) .setPrimaryKeyNames(table.filterColumnNames(c -> table.isPrimaryKeyColumn(c.name()))).create(); } }
table.setColumns(newColumnDefn); } else if (tokens.matches("DROP", "CONSTRAINT")) { parseDropTableConstraint(start, table);
/** * Use the supplied table editor to create columns for the supplied result set. * * @param resultSet the query result set; may not be null * @param editor the consumer of the definitions; may not be null * @throws SQLException if an error occurs while using the result set */ public static void columnsFor(ResultSet resultSet, TableEditor editor) throws SQLException { List<Column> columns = new ArrayList<>(); columnsFor(resultSet, columns::add); editor.setColumns(columns); }
@Override public TableEditor edit() { return new TableEditorImpl().tableId(id) .setColumns(columnDefs) .setPrimaryKeyNames(pkColumnNames) .setDefaultCharsetName(defaultCharsetName); } }
private Table tableFromFromMessage(List<ReplicationMessage.Column> columns, Table table) { return table.edit() .setColumns(columns.stream() .map(column -> { final PostgresType type = column.getType(); final ColumnEditor columnEditor = Column.editor() .name(column.getName()) .jdbcType(type.getJdbcId()) .type(type.getName()) .optional(column.isOptional()) .nativeType(type.getOid()); columnEditor.length(column.getTypeMetadata().getLength()); columnEditor.scale(column.getTypeMetadata().getScale()); return columnEditor.create(); }) .collect(Collectors.toList()) ) .setPrimaryKeyNames(table.filterColumnNames(c -> table.isPrimaryKeyColumn(c.name()))).create(); } }
table.setColumns(newColumnDefn); } else if (tokens.matches("DROP", "CONSTRAINT")) { parseDropTableConstraint(start, table);