本文整理汇总了Java中net.sf.jsqlparser.statement.select.PlainSelect.getFromItem方法的典型用法代码示例。如果您正苦于以下问题:Java PlainSelect.getFromItem方法的具体用法?Java PlainSelect.getFromItem怎么用?Java PlainSelect.getFromItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jsqlparser.statement.select.PlainSelect
的用法示例。
在下文中一共展示了PlainSelect.getFromItem方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: processPlainSelect
import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
/**
* <p>
* 处理 PlainSelect
* </p>
*
* @param plainSelect
* @param addColumn 是否添加租户列,insert into select语句中需要
*/
protected void processPlainSelect(PlainSelect plainSelect, boolean addColumn) {
FromItem fromItem = plainSelect.getFromItem();
if (fromItem instanceof Table) {
Table fromTable = (Table) fromItem;
if (this.tenantHandler.doTableFilter(fromTable.getName())) {
// 过滤退出执行
return;
}
plainSelect.setWhere(builderExpression(plainSelect.getWhere(), fromTable));
if (addColumn) {
plainSelect.getSelectItems().add(new SelectExpressionItem(new Column(this.tenantHandler.getTenantIdColumn())));
}
} else {
processFromItem(fromItem);
}
List<Join> joins = plainSelect.getJoins();
if (joins != null && joins.size() > 0) {
for (Join join : joins) {
processJoin(join);
processFromItem(join.getRightItem());
}
}
}
示例3: 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);
}
示例4: 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);
}
}
示例5: getEntityAlias
import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
protected static String getEntityAlias(String entityName, PlainSelect query) {
FromItem fromItem = query.getFromItem();
if (hasEntityAlias(entityName, fromItem)) {
return fromItem.getAlias();
}
if (query.getJoins() != null) {
for (Object o : query.getJoins()) {
Join join = (Join) o;
if (hasEntityAlias(entityName, join.getRightItem())) {
return join.getRightItem().getAlias();
}
}
}
logger.debug("Alias from entity " + entityName + " not found in query " + query);
return null;
}
示例6: setPlainSelectParameters
import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
private void setPlainSelectParameters(PlainSelect plainSelect, com.google.cloud.spanner.Statement.Builder builder)
{
if (plainSelect.getFromItem() != null)
{
plainSelect.getFromItem().accept(new FromItemVisitorAdapter()
{
private int tableCount = 0;
@Override
public void visit(Table table)
{
tableCount++;
if (tableCount == 1)
getParameterStore().setTable(unquoteIdentifier(table.getFullyQualifiedName()));
else
getParameterStore().setTable(null);
}
});
}
setWhereParameters(plainSelect.getWhere(), builder);
if (plainSelect.getLimit() != null)
{
setWhereParameters(plainSelect.getLimit().getRowCount(), builder);
}
if (plainSelect.getOffset() != null && plainSelect.getOffset().isOffsetJdbcParameter())
{
ValueBinderExpressionVisitorAdapter<com.google.cloud.spanner.Statement.Builder> binder = new ValueBinderExpressionVisitorAdapter<>(
getParameterStore(), builder.bind("p" + getParameterStore().getHighestIndex()), null);
binder.setValue(getParameterStore().getParameter(getParameterStore().getHighestIndex()));
getParameterStore().setType(getParameterStore().getHighestIndex(), Types.BIGINT);
}
}
示例7: 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());
}
}
示例8: 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 (Join join : plainSelect.getJoins()) {
join.getRightItem().accept(this);
}
}
}
示例9: 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);
}
示例10: plainSelectToStringAppendWithNoLock
import net.sf.jsqlparser.statement.select.PlainSelect; //导入方法依赖的package包/类
private static String plainSelectToStringAppendWithNoLock(PlainSelect plain) {
StringBuilder sql = new StringBuilder("SELECT ");
if (plain.getDistinct() != null)
sql.append(plain.getDistinct()).append(" ");
if (plain.getTop() != null)
sql.append(plain.getTop()).append(" ");
sql.append(PlainSelect.getStringList(plain.getSelectItems()));
if (plain.getFromItem() != null) {
sql.append(" FROM ").append(plain.getFromItem()).append(" WITH (NOLOCK) ");
if (plain.getJoins() != null) {
Iterator<Join> it = plain.getJoins().iterator();
while (it.hasNext()) {
Join join = it.next();
if (join.isSimple()) {
sql.append(", ").append(join).append(" WITH (NOLOCK) ");
} else {
String temp = join.toString().replace(join.getRightItem().toString(),
join.getRightItem().toString() + " WITH (NOLOCK) ");
sql.append(" ").append(temp);
}
}
}
if (plain.getWhere() != null)
sql.append(" WHERE ").append(plain.getWhere());
if (plain.getOracleHierarchical() != null)
sql.append(plain.getOracleHierarchical().toString());
sql.append(PlainSelect.getFormatedList(plain.getGroupByColumnReferences(), "GROUP BY"));
if (plain.getHaving() != null)
sql.append(" HAVING ").append(plain.getHaving());
sql.append(PlainSelect.orderByToString(plain.isOracleSiblings(), plain.getOrderByElements()));
if (plain.getLimit() != null)
sql.append(plain.getLimit());
}
return sql.toString();
}