net.sf.jsqlparser.statement.select.FromItem Java Examples
The following examples show how to use
net.sf.jsqlparser.statement.select.FromItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 6 votes |
private void addToSQLHolderMap(FromItem from) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException { if (from instanceof Table) { Table table = (Table)from; fromToSQLHolder.put(table, new SQLTableInfoHolder(table.getName())); } else if(from instanceof SubSelect){ SubSelect subselect = (SubSelect) from; fromToSQLHolder.put(from, SQLCommandInfoHolder.Builder .create(defaultFieldType, fieldNameToFieldTypeMapping) .setPlainSelect((PlainSelect)subselect.getSelectBody()) .build()); } else {//Not happen SubJoin, not supported previously return; } }
Example #2
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 5 votes |
private void addBaseFrom(FromItem from, String alias) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException { addBaseFrom(from); if(alias != null) { baseAlias = alias; aliasToTable.put(alias, from); } tableToAlias.put(from, alias); }
Example #3
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 5 votes |
public void addFrom(FromItem from) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException { if(baseFrom != null) { tableToAlias.put(from, null); addToSQLHolderMap(from); } else { addBaseFrom(from); } }
Example #4
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 5 votes |
public void addFrom(FromItem from, String alias) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException { if(baseFrom != null) { if(alias != null) { aliasToTable.put(alias, from); } tableToAlias.put(from, alias); addToSQLHolderMap(from); } else { addBaseFrom(from, alias); } }
Example #5
Source File: CTEToNestedQueryConverter.java From quetzal with Eclipse Public License 2.0 | 5 votes |
@Override public void visit(SubJoin subjoin) { if (subjoin.getLeft()!=null) { subjoin.getLeft().accept(this); subjoin.setLeft(result); } if (subjoin.getJoin().getRightItem()!=null) { FromItem right = subjoin.getJoin().getRightItem(); right.accept(this); subjoin.getJoin().setRightItem(result); } result = subjoin; }
Example #6
Source File: SelectVisitorImpl.java From DataPermissionHelper with Apache License 2.0 | 4 votes |
@Override public void visit(PlainSelect plainSelect) { // 访问 select if (plainSelect.getSelectItems() != null) { for (SelectItem item : plainSelect.getSelectItems()) { item.accept(new SelectItemVisitorImpl()); } } // 访问from FromItem fromItem = plainSelect.getFromItem(); FromItemVisitorImpl fromItemVisitorImpl = new FromItemVisitorImpl(); fromItem.accept(fromItemVisitorImpl); if (fromItemVisitorImpl.getSubSelect() != null) { plainSelect.setFromItem(fromItemVisitorImpl.getSubSelect()); if (!DPHelper.getChangeTable()) { DPHelper.setChangeTable(true); } } // 访问where if (plainSelect.getWhere() != null) { plainSelect.getWhere().accept(new ExpressionVisitorImpl()); } // 访问join if (plainSelect.getJoins() != null) { for (Join join : plainSelect.getJoins()) { FromItemVisitorImpl fromItemVisitorImplTemp = new FromItemVisitorImpl(); join.getRightItem().accept(fromItemVisitorImplTemp); if (fromItemVisitorImplTemp.getSubSelect() != null) { join.setRightItem(fromItemVisitorImplTemp.getSubSelect()); if (!DPHelper.getChangeTable()) { DPHelper.setChangeTable(true); } } } } // 访问 order by if (plainSelect.getOrderByElements() != null) { for (OrderByElement orderByElement : plainSelect .getOrderByElements()) { orderByElement.getExpression().accept( new ExpressionVisitorImpl()); } } // 访问group by having if (plainSelect.getHaving() != null) { plainSelect.getHaving().accept(new ExpressionVisitorImpl()); } }
Example #7
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 4 votes |
private void addBaseFrom(FromItem from) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException { baseFrom = from; addToSQLHolderMap(from); }
Example #8
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 4 votes |
public FromItem getBaseFrom() throws ParseException { return baseFrom; }
Example #9
Source File: FromHolder.java From sql-to-mongo-db-query-converter with Apache License 2.0 | 4 votes |
public SQLInfoHolder getSQLHolder(FromItem fitem) throws ParseException { return fromToSQLHolder.get(fitem); }
Example #10
Source File: CTEToNestedQueryConverter.java From quetzal with Eclipse Public License 2.0 | 4 votes |
public FromItem getResult() { return result; }