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


Java Expression.accept方法代码示例

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


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

示例1: visitDeleteWhereClause

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
private void visitDeleteWhereClause(Expression where, DeleteKeyBuilder keyBuilder,
		boolean generateParameterMetaData) throws SQLException
{
	if (where != null)
	{
		DMLWhereClauseVisitor whereClauseVisitor = new DMLWhereClauseVisitor(getParameterStore())
		{

			@Override
			protected void visitExpression(Column col, Expression expression)
			{
				String columnName = unquoteIdentifier(col.getFullyQualifiedName());
				keyBuilder.set(columnName);
				expression.accept(
						new KeyBuilderExpressionVisitorAdapter(getParameterStore(), columnName, keyBuilder));
			}

		};
		where.accept(whereClauseVisitor);
		if (!generateParameterMetaData && !whereClauseVisitor.isValid())
		{
			throw new CloudSpannerSQLException(INVALID_WHERE_CLAUSE_DELETE_MESSAGE, Code.INVALID_ARGUMENT);
		}
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:26,代码来源:CloudSpannerPreparedStatement.java

示例2: isSingleRowWhereClause

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
private boolean isSingleRowWhereClause(TableKeyMetaData table, Expression where)
{
	if (where != null)
	{
		SingleRowWhereClauseValidator validator = new SingleRowWhereClauseValidator(table);
		DMLWhereClauseVisitor whereClauseVisitor = new DMLWhereClauseVisitor(getParameterStore())
		{

			@Override
			protected void visitExpression(Column col, Expression expression)
			{
				String columnName = unquoteIdentifier(col.getFullyQualifiedName());
				validator.set(columnName);
				expression.accept(
						new SingleRowWhereClauseValidatorExpressionVisitorAdapter(getParameterStore(), validator));
			}

		};
		where.accept(whereClauseVisitor);
		return whereClauseVisitor.isValid() && validator.isValid();
	}
	return false;
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:24,代码来源:CloudSpannerPreparedStatement.java

示例3: visit

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
@Override
public void visit(MultiExpressionList multiExprList) {
    buffer.append(" VALUES ");
    for (Iterator<ExpressionList> it = multiExprList.getExprList().iterator(); it.hasNext();) {
        buffer.append("(");
        for (Iterator<Expression> iter = it.next().getExpressions().iterator(); iter.hasNext();) {
            Expression expression = iter.next();
            expression.accept(expressionVisitor);
            if (iter.hasNext()) {
                buffer.append(", ");
            }
        }
        buffer.append(")");
        if (it.hasNext()) {
            buffer.append(", ");
        }
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:19,代码来源:InsertDeParser.java

示例4: visit

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
@Override
public void visit(ExpressionList expressionList) {
    if (useBracketsInExprList) {
        buffer.append("(");
    }
    for (Iterator<Expression> iter = expressionList.getExpressions().iterator(); iter.hasNext();) {
        Expression expression = iter.next();
        expression.accept(this);
        if (iter.hasNext()) {
            buffer.append(", ");
        }
    }
    if (useBracketsInExprList) {
        buffer.append(")");
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:17,代码来源:ExpressionDeParser.java

示例5: visit

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
@Override
public void visit(Update update) {
    for (Table table : update.getTables()) {
        tables.add(table.getName());
    }
    if (update.getExpressions() != null) {
        for (Expression expression : update.getExpressions()) {
            expression.accept(this);
        }
    }

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

    if (update.getJoins() != null) {
        for (Join join : update.getJoins()) {
            join.getRightItem().accept(this);
        }
    }

    if (update.getWhere() != null) {
        update.getWhere().accept(this);
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:26,代码来源:TablesNamesFinder.java

示例6: setWhereParameters

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
private void setWhereParameters(Expression where, com.google.cloud.spanner.Statement.Builder builder)
{
	if (where != null)
	{
		where.accept(new ExpressionVisitorAdapter()
		{
			private String currentCol = null;

			@Override
			public void visit(Column col)
			{
				currentCol = unquoteIdentifier(col.getFullyQualifiedName());
			}

			@Override
			public void visit(JdbcParameter parameter)
			{
				parameter.accept(new ValueBinderExpressionVisitorAdapter<>(getParameterStore(),
						builder.bind("p" + parameter.getIndex()), currentCol));
				currentCol = null;
			}

			@Override
			public void visit(SubSelect subSelect)
			{
				setSelectParameters(subSelect.getSelectBody(), builder);
			}

		});
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:32,代码来源:CloudSpannerPreparedStatement.java

示例7: visitUpdateWhereClause

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
private void visitUpdateWhereClause(Expression where, WriteBuilder builder, boolean generateParameterMetaData)
		throws SQLException
{
	if (where != null)
	{
		DMLWhereClauseVisitor whereClauseVisitor = new DMLWhereClauseVisitor(getParameterStore())
		{

			@Override
			protected void visitExpression(Column col, Expression expression)
			{
				String columnName = unquoteIdentifier(col.getFullyQualifiedName());
				expression.accept(new ValueBinderExpressionVisitorAdapter<>(getParameterStore(),
						builder.set(columnName), columnName));
			}

		};
		where.accept(whereClauseVisitor);
		if (!generateParameterMetaData && !whereClauseVisitor.isValid())
		{
			throw new CloudSpannerSQLException(INVALID_WHERE_CLAUSE_UPDATE_MESSAGE, Code.INVALID_ARGUMENT);
		}
	}
	else
	{
		throw new SQLException(INVALID_WHERE_CLAUSE_UPDATE_MESSAGE);
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:29,代码来源:CloudSpannerPreparedStatement.java

示例8: visit

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
@Override
public void visit(ExpressionList expressionList) {
	buffer.append(" VALUES (");
	for (Iterator<Expression> iter = expressionList.getExpressions().iterator(); iter.hasNext();) {
		Expression expression = iter.next();
		expression.accept(expressionVisitor);
		if (iter.hasNext()) {
			buffer.append(", ");
		}
	}
	buffer.append(")");
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:13,代码来源:ReplaceDeParser.java

示例9: getTableList

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
/**
 * Main entry for this Tool class. A list of found tables is returned.
 *
 * @param update
 * @return
 */

public List<String> getTableList(Expression expr) {
    init();
    expr.accept(this);
    return tables;
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:13,代码来源:TablesNamesFinder.java

示例10: visit

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
@Override
public void visit(ExpressionList expressionList) {
    for (Iterator<?> iter = expressionList.getExpressions().iterator();iter.hasNext();) {
        Expression expression = (Expression) iter.next();
        expression.accept(this);
    }
}
 
开发者ID:devpage,项目名称:sharding-quickstart,代码行数:8,代码来源:TablesNamesFinder.java

示例11: addFieldsToSelect

import net.sf.jsqlparser.expression.Expression; //导入方法依赖的package包/类
/**
 * The constraints in the WHERE clause might reference
 * fields that are not retrieved in the SELECT.
 * Therefore, we need to add them, otherwise it
 * would not be possible to calculate any heuristics
 *
 * @param select the string containing the SQL SELECT command
 * @return  the modified SQL SELECT
 */
public static String addFieldsToSelect(String select) {

    Select stmt = asStatement(select);

    SelectBody selectBody = stmt.getSelectBody();
    if (selectBody instanceof PlainSelect) {
        PlainSelect plainSelect = (PlainSelect) selectBody;

        Expression where = plainSelect.getWhere();
        if (where == null) {
            //nothing to do
            return select;
        }

        List<SelectItem> fields = plainSelect.getSelectItems();

        where.accept(new ExpressionVisitorAdapter() {
            @Override
            public void visit(Column column) {

                String target = column.toString();

                boolean found = false;
                for (SelectItem si : fields) {
                    SelectExpressionItem field = (SelectExpressionItem) si;
                    String exp = field.getExpression().toString();
                    if (target.equals(exp)) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    SelectExpressionItem item = new SelectExpressionItem();
                    item.setExpression(column);
                    fields.add(item);
                }
            }
        });
    }

    return stmt.toString();
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:52,代码来源:SelectHeuristics.java


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