当前位置: 首页>>代码示例>>Java>>正文


Java PlainSelect.getWhere方法代码示例

本文整理汇总了Java中net.sf.jsqlparser.statement.select.PlainSelect.getWhere方法的典型用法代码示例。如果您正苦于以下问题:Java PlainSelect.getWhere方法的具体用法?Java PlainSelect.getWhere怎么用?Java PlainSelect.getWhere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jsqlparser.statement.select.PlainSelect的用法示例。


在下文中一共展示了PlainSelect.getWhere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
    if (plainSelect.getSelectItems() != null) {
        for (SelectItem item : plainSelect.getSelectItems()) {
            item.accept(this);
        }
    }

    if (plainSelect.getFromItem() != null) {
        plainSelect.getFromItem().accept(this);
    }

    if (plainSelect.getJoins() != null) {
        for (Join join : plainSelect.getJoins()) {
            join.getRightItem().accept(this);
        }
    }
    if (plainSelect.getWhere() != null) {
        plainSelect.getWhere().accept(this);
    }
    if (plainSelect.getOracleHierarchical() != null) {
        plainSelect.getOracleHierarchical().accept(this);
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:25,代码来源:TablesNamesFinder.java

示例2: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public void visit(PlainSelect plainSelect) {
	List<SelectItem> cols = plainSelect.getSelectItems();
	for(SelectItem col : cols){
		col.accept(this);
	}

	if(plainSelect.getFromItem()!=null){
		plainSelect.getFromItem().accept(this);
	}

	if (plainSelect.getJoins() != null) {
		for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
			Join join = (Join) joinsIt.next();
			join.getRightItem().accept(this);
		}
	}
	if (plainSelect.getWhere() != null)
		plainSelect.getWhere().accept(this);

}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:21,代码来源:TableFinder.java

示例3: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
    if (plainSelect.getFromItem() != null) {
        plainSelect.getFromItem().accept(this);
    }

    if (plainSelect.getJoins() != null) {
        for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
            Join join = (Join) joinsIt.next();
            join.getRightItem().accept(this);
        }
    }
    if (plainSelect.getWhere() != null) {
        plainSelect.getWhere().accept(this);
    }
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:17,代码来源:TablesFinder.java

示例4: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect ps) {
    
    ps.getFromItem().accept(this);
    
    if (ps.getJoins() != null) {
        for (Join j : ps.getJoins()) {
            j.getRightItem().accept(this);
        }
    }

    if (ps.getWhere() != null) {
        ps.getWhere().accept(this);
    }
    
    if (ps.getOracleHierarchical() != null) {
        ps.getOracleHierarchical().accept(this);
    }

}
 
开发者ID:valdasraps,项目名称:resthub,代码行数:21,代码来源:UpdateSelectParser.java

示例5: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
    plainSelect.getFromItem().accept(this);
    if (plainSelect.getJoins()!=null) {
        for(Iterator<?> joinsIt = plainSelect.getJoins().iterator();joinsIt.hasNext();){
            Join join = (Join) joinsIt.next();
            join.getRightItem().accept(this);
        }
    }
    
    if (plainSelect.getWhere() != null) {
        plainSelect.getWhere().accept(this);
    }
}
 
开发者ID:devpage,项目名称:sharding-quickstart,代码行数:15,代码来源:TablesNamesFinder.java

示例6: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
    if (plainSelect.getDistinct() != null && plainSelect.getDistinct().getOnSelectItems() != null) {
        plainSelect.getDistinct().getOnSelectItems().forEach(s -> s.accept(this));
    }
    if (plainSelect.getFromItem() != null) {
        plainSelect.getFromItem().accept(this);
    }
    if (plainSelect.getGroupByColumnReferences() != null) {
        plainSelect.getGroupByColumnReferences().forEach(s -> s.accept(this));
    }
    if (plainSelect.getHaving() != null) {
        plainSelect.getHaving().accept(this);
    }
    if (plainSelect.getJoins() != null) {
        plainSelect.getJoins().forEach(
            j -> {
                visitJoin(j);
            }
        );
    }
    if (plainSelect.getOrderByElements() != null) {
        plainSelect.getOrderByElements().forEach(s -> s.accept(this));
    }
    if (plainSelect.getSelectItems() != null) {
        plainSelect.getSelectItems().forEach(s -> s.accept(this));
    }
    if (plainSelect.getTop() != null) {
        plainSelect.getTop().getExpression().accept(this);
    }
    if (plainSelect.getWhere() != null) {
        plainSelect.getWhere().accept(this);
    }
    if (plainSelect.getLimit() != null) {
        visitLimit(plainSelect.getLimit());
    }

}
 
开发者ID:diennea,项目名称:herddb,代码行数:39,代码来源:JdbcQueryRewriter.java

示例7: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public void visit(PlainSelect plainSelect) {
	plainSelect.getFromItem().accept(this);
	
	if (plainSelect.getJoins() != null) {
		for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
			Join join = (Join) joinsIt.next();
			join.getRightItem().accept(this);
		}
	}
	if (plainSelect.getWhere() != null)
		plainSelect.getWhere().accept(this);

}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:14,代码来源:TablesNamesFinder.java

示例8: insertWhereAndExpression

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
/**
 * 往where sql里面插入AND关系的表达式。
 * 
 * 例如:whereSql为 where a!=3 or a!=2 limit 1
 *      condExpress为 deleted=0
 * 那么返回:where deleted=0 and (a!=3 or a!=2) limit 1
 * 
 * @param whereSql 从where起的sql子句,如果有where必须带上where关键字。
 * @param condExpression 例如a=?  不带where或and关键字。
 * @return 注意返回字符串前面没有空格
 * @throws JSQLParserException 
 */
public static String insertWhereAndExpression(String whereSql, String condExpression) 
		throws JSQLParserException {
	
	if(condExpression == null || condExpression.trim().isEmpty()) {
		return whereSql == null ? "" : whereSql;
	}
	if(whereSql == null || whereSql.trim().isEmpty()) {
		return "WHERE " + condExpression;
	}
	
	whereSql = whereSql.trim();
	if(!whereSql.toUpperCase().startsWith("WHERE ")) {
		return "WHERE " + condExpression + " " + whereSql;
	}
	
	
	String selectSql = "select * from dual "; // 辅助where sql解析用
	Statement statement = CCJSqlParserUtil.parse(selectSql + whereSql);
	Select selectStatement = (Select) statement;
	PlainSelect plainSelect = (PlainSelect)selectStatement.getSelectBody();
	
	Expression ce = CCJSqlParserUtil.parseCondExpression(condExpression);
	Expression oldWhere = plainSelect.getWhere();
	Expression newWhere = new FixedAndExpression(ce, oldWhere);
	plainSelect.setWhere(newWhere);
	
	return plainSelect.toString().substring(selectSql.length());
}
 
开发者ID:pugwoo,项目名称:nimble-orm,代码行数:41,代码来源:SQLUtils.java

示例9: parse

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public Set<String> parse(SelectBody selectBody) {
	
	Set<String> tableSet = new HashSet<String>();
	
	if (selectBody != null) {
		if (selectBody instanceof PlainSelect) {
			PlainSelect plainSelect = (PlainSelect) selectBody;
			tableSet.addAll(parseTable(plainSelect.getFromItem()));
			
			List<Join> joins = plainSelect.getJoins();
			if (joins != null) {
				for (Join join : joins) {
					tableSet.addAll(parseTable(join.getRightItem()));
				}
			}
			
			Expression expression = plainSelect.getWhere();
			if (expression != null) {
				tableSet.addAll(parseExpression(expression));
			}
		}

		if (selectBody instanceof SetOperationList) {
			SetOperationList setList = (SetOperationList) selectBody;
			for (SelectBody select : setList.getSelects()) {
				tableSet.addAll(parse(select));
			}
		}
		
	}
	return tableSet;
}
 
开发者ID:PinaeOS,项目名称:timon,代码行数:33,代码来源:SelectParser.java

示例10: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public void visit(PlainSelect plainSelect) {
    plainSelect.getFromItem().accept(this);

    if (plainSelect.getJoins() != null) {
        for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
            Join join = (Join) joinsIt.next();
            join.getRightItem().accept(this);
        }
    }
    if (plainSelect.getWhere() != null) {
        plainSelect.getWhere().accept(this);
    }

}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:15,代码来源:TablesNamesFinder.java

示例11: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public void visit(PlainSelect plainSelect) {
plainSelect.getFromItem().accept(this);

if (plainSelect.getJoins() != null) {
	for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
		Join join = (Join) joinsIt.next();
		join.getRightItem().accept(this);
	}
}
if (plainSelect.getWhere() != null)
	plainSelect.getWhere().accept(this);

     visitColumns(plainSelect);
  }
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:15,代码来源:SelectItemFinder.java

示例12: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public void visit(PlainSelect plainSelect) {
  plainSelect.getFromItem().accept(this);

  if (plainSelect.getJoins() != null) {
      for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
          Join join = (Join) joinsIt.next();
          join.getRightItem().accept(this);
      }
  }
  if (plainSelect.getWhere() != null)
      plainSelect.getWhere().accept(this);

}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:14,代码来源:InsertItemFinder.java

示例13: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
public void visit(PlainSelect plainSelect) {
    plainSelect.getFromItem().accept(this);

    if (plainSelect.getJoins() != null) {
        for (Iterator joinsIt = plainSelect.getJoins().iterator(); joinsIt.hasNext();) {
            Join join = (Join) joinsIt.next();
            join.getRightItem().accept(this);
        }
    }
    if (plainSelect.getWhere() != null)
        plainSelect.getWhere().accept(this);
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:13,代码来源:UpdateItemFinder.java

示例14: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect plainSelect)
{
   /*
    * Check if the query uses DISTINCT flag
    */
   checkContainDistinct(plainSelect);
   
   FromItem fromItem = plainSelect.getFromItem();
   visitFromItemExpression(fromItem);
   
   /*
    * Collect the tables in the JOIN statement
    */
   List<Join> joins = plainSelect.getJoins();
   if (joins != null) {
      for (Join join : joins) {
         visitJoinExpression(join);
      }
   }
   
   /*
    * Collect the filter expressions in WHERE statement
    */
   Expression expr = plainSelect.getWhere();
   if (expr != null) {
      visitWhereExpression(expr);
   }
   
   /*
    * Collect the select item expressions in SELECT statement.
    */
   List<SelectItem> selectItemExpressions = plainSelect.getSelectItems();
   SelectItemHandler selectItemHandler = new SelectItemHandler(this);
   selectItemHandler.parse(selectItemExpressions);
}
 
开发者ID:obidea,项目名称:semantika,代码行数:37,代码来源:SelectStatementHandler.java

示例15: visit

import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
@Override
public void visit(PlainSelect plainSelect) {
	plainSelect.getFromItem().accept(this);

	plainSelect.getSelectItems().forEach(item -> item.accept(this));

	isSelect = false;

	if (plainSelect.getWhere() != null) {
		plainSelect.getWhere().accept(this);
	}
}
 
开发者ID:ormanli,项目名称:SQL2NoSQL,代码行数:13,代码来源:SQLVisitor.java


注:本文中的net.sf.jsqlparser.statement.select.PlainSelect.getWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。