use of net.sf.jsqlparser.statement.select.SelectItemVisitor in project spanner-jdbc by olavloite.
the class CloudSpannerResultSetMetaData method initColumns.
private void initColumns(Select select) {
columns = new ArrayList<>();
aliases = new ArrayList<>();
select.getSelectBody().accept(new SelectVisitorAdapter() {
@Override
public void visit(PlainSelect plainSelect) {
for (SelectItem selectItem : plainSelect.getSelectItems()) {
selectItem.accept(new SelectItemVisitor() {
private boolean foundColumn = false;
@Override
public void visit(SelectExpressionItem selectExpressionItem) {
selectExpressionItem.getExpression().accept(new ExpressionVisitorAdapter() {
@Override
public void visit(Column column) {
registerColumn(column, selectExpressionItem.getAlias());
foundColumn = true;
}
});
if (!foundColumn) {
registerColumn(null, selectExpressionItem.getAlias());
}
}
@Override
public void visit(AllTableColumns allTableColumns) {
registerAllTableColumns(allTableColumns.getTable());
}
@Override
public void visit(AllColumns allColumns) {
for (Table table : tables) {
registerAllTableColumns(table);
}
}
});
}
}
});
}
Aggregations