本文整理汇总了Java中net.sf.jsqlparser.expression.operators.relational.EqualsTo类的典型用法代码示例。如果您正苦于以下问题:Java EqualsTo类的具体用法?Java EqualsTo怎么用?Java EqualsTo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EqualsTo类属于net.sf.jsqlparser.expression.operators.relational包,在下文中一共展示了EqualsTo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: builderExpression
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
/**
* 处理条件
*/
protected Expression builderExpression(Expression expression, Table table) {
//生成字段名
EqualsTo equalsTo = new EqualsTo();
equalsTo.setLeftExpression(this.getAliasColumn(table));
equalsTo.setRightExpression(tenantHandler.getTenantId());
//加入判断防止条件为空时生成 "and null" 导致查询结果为空
if (expression == null) {
return equalsTo;
} else {
if (expression instanceof BinaryExpression) {
BinaryExpression binaryExpression = (BinaryExpression) expression;
if (binaryExpression.getLeftExpression() instanceof FromItem) {
processFromItem((FromItem) binaryExpression.getLeftExpression());
}
if (binaryExpression.getRightExpression() instanceof FromItem) {
processFromItem((FromItem) binaryExpression.getRightExpression());
}
}
return new AndExpression(equalsTo, expression);
}
}
示例2: parseWhere
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
private void parseWhere(Expression where, int sequence) {
log.debug("parse WHERE expression " + where);
if (where == null) {
log.info("No WHERE clause. Seems not to be a primary key condition");
} else if (where instanceof AndExpression) {
AndExpression and = (AndExpression) where;
parseWhere(and.getLeftExpression(), sequence);
parseWhere(and.getRightExpression(), sequence + 1);
} else if (where instanceof BinaryExpression) {
BinaryExpression exp = (BinaryExpression) where;
if (!(exp.getLeftExpression() instanceof Column)) {
if (log.isDebugEnabled()) {
log.debug(exp.getLeftExpression().toString()
+ exp.getStringExpression() + exp.getRightExpression()
+ " is not a unique condition for the primary key column");
}
return;
}
List<SqlParameter> paramList = parameterMap.get(sql);
if (paramList == null) {
paramList = new ArrayList<SqlParameter>();
parameterMap.put(sql, paramList);
}
findPrimaryKeyColumn();
SqlExpressionParser expParser = new SqlExpressionParser();
exp.getRightExpression().accept(expParser);
Object value = expParser.getValue();
String colName = ((Column) exp.getLeftExpression()).getColumnName();
SqlParameter sqlParam = new SqlParameter(colName, value);
if ("?".equals(value)) {
sequence++;
sqlParam.setSequence(sequence);
}
if (colName.equalsIgnoreCase(primaryKeyColumn)
&& exp instanceof EqualsTo) {
primaryKeys.put(sql, sqlParam);
}
paramList.add(sqlParam);
if (log.isDebugEnabled()) {
log.debug("parse WHERE column " + sqlParam);
}
} else {
log.info("WHERE clause does not contain a unique primary key condition.");
}
}
示例3: visit
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
@Override
public void visit(EqualsTo expr)
{
// If it is an NOT ID=1, then it's not a valid equals clause
foundEquals = !expr.isNot();
super.visit(expr);
}
示例4: visitOldOracleJoinBinaryExpression
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
public void visitOldOracleJoinBinaryExpression(OldOracleJoinBinaryExpression expression, String operator) {
if (expression.isNot()) {
buffer.append(NOT);
}
expression.getLeftExpression().accept(this);
if (expression.getOldOracleJoinSyntax() == EqualsTo.ORACLE_JOIN_RIGHT) {
buffer.append("(+)");
}
buffer.append(operator);
expression.getRightExpression().accept(this);
if (expression.getOldOracleJoinSyntax() == EqualsTo.ORACLE_JOIN_LEFT) {
buffer.append("(+)");
}
}
示例5: buildSimplePredicate
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
private Predicate buildSimplePredicate(Expression where, Table table, String tableAlias) {
if (where instanceof EqualsTo || where == null) {
// surely this is the only predicate on the PK, we can skip it
return null;
}
return new SQLRecordPredicate(table, tableAlias, where);
}
示例6: andExpression
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
/**
* <p>
* delete update 语句 where 处理
* </p>
*/
protected BinaryExpression andExpression(Table table, Expression where) {
//获得where条件表达式
EqualsTo equalsTo = new EqualsTo();
if (null != where) {
equalsTo.setLeftExpression(new Column(this.tenantHandler.getTenantIdColumn()));
equalsTo.setRightExpression(tenantHandler.getTenantId());
return new AndExpression(equalsTo, where);
}
equalsTo.setLeftExpression(this.getAliasColumn(table));
equalsTo.setRightExpression(tenantHandler.getTenantId());
return equalsTo;
}
示例7: visitBinaryExpression
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
protected ISqlExpression visitBinaryExpression(BinaryExpression binaryExpression)
{
binaryExpression.getLeftExpression().accept(this);
ISqlExpression leftParameter = getExpression();
binaryExpression.getRightExpression().accept(this);
ISqlExpression rightParameter = getExpression();
if (binaryExpression instanceof EqualsTo) {
return sSqlFactory.createEqualsToExpression(leftParameter, rightParameter);
}
else if (binaryExpression instanceof NotEqualsTo) {
return sSqlFactory.createNotEqualsToExpression(leftParameter, rightParameter);
}
else if (binaryExpression instanceof GreaterThan) {
return sSqlFactory.createGreaterThanExpression(leftParameter, rightParameter);
}
else if (binaryExpression instanceof GreaterThanEquals) {
return sSqlFactory.createGreaterThanEqualsExpression(leftParameter, rightParameter);
}
else if (binaryExpression instanceof MinorThan) {
return sSqlFactory.createLessThanExpression(leftParameter, rightParameter);
}
else if (binaryExpression instanceof MinorThanEquals) {
return sSqlFactory.createLessThanEqualsExpression(leftParameter, rightParameter);
}
throw new UnsupportedSqlExpressionException(binaryExpression.toString());
}
示例8: visit
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
@Override
public void visit(EqualsTo equalsTo)
{
equalsTo.getLeftExpression().accept(this);
SqlColumn leftColumn = copy(mJoinColumn);
equalsTo.getRightExpression().accept(this);
SqlColumn rightColumn = copy(mJoinColumn);
mJoinCondition.add(new SqlJoinCondition(leftColumn, rightColumn));
}
示例9: visit
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
@Override
public void visit(EqualsTo expr) {
visitBinaryExpression(expr);
}
示例10: visit
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
@Override
public void visit(EqualsTo equalsTo) {
visitOldOracleJoinBinaryExpression(equalsTo, " = ");
}
示例11: visit
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
@Override
public void visit(EqualsTo equalsTo) {
visitBinaryExpression(equalsTo);
}
示例12: discoverIndexOperations
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
private void discoverIndexOperations(Expression expressionWhere, Table table, String mainTableAlias, SQLRecordPredicate where, TableSpaceManager tableSpaceManager) throws StatementExecutionException {
SQLRecordKeyFunction keyFunction = findIndexAccess(expressionWhere, table.primaryKey, table, mainTableAlias, EqualsTo.class);
IndexOperation result = null;
if (keyFunction != null) {
if (keyFunction.isFullPrimaryKey()) {
result = new PrimaryIndexSeek(keyFunction);
} else {
result = new PrimaryIndexPrefixScan(keyFunction);
}
} else {
SQLRecordKeyFunction rangeMin = findIndexAccess(expressionWhere, table.primaryKey,
table, mainTableAlias, GreaterThanEquals.class
);
if (rangeMin != null && !rangeMin.isFullPrimaryKey()) {
rangeMin = null;
}
if (rangeMin == null) {
rangeMin = findIndexAccess(expressionWhere, table.primaryKey, table, mainTableAlias, GreaterThan.class);
if (rangeMin != null && !rangeMin.isFullPrimaryKey()) {
rangeMin = null;
}
}
SQLRecordKeyFunction rangeMax = findIndexAccess(expressionWhere, table.primaryKey, table, mainTableAlias, MinorThanEquals.class
);
if (rangeMax != null && !rangeMax.isFullPrimaryKey()) {
rangeMax = null;
}
if (rangeMax == null) {
rangeMax = findIndexAccess(expressionWhere, table.primaryKey, table, mainTableAlias, MinorThan.class
);
if (rangeMax != null && !rangeMax.isFullPrimaryKey()) {
rangeMax = null;
}
}
if (rangeMin != null || rangeMax != null) {
result = new PrimaryIndexRangeScan(table.primaryKey, rangeMin, rangeMax);
}
}
if (result == null) {
Map<String, AbstractIndexManager> indexes = tableSpaceManager.getIndexesOnTable(table.name);
if (indexes != null) {
// TODO: use some kind of statistics, maybe using an index is more expensive than a full table scan
for (AbstractIndexManager index : indexes.values()) {
if (!index.isAvailable()) {
continue;
}
IndexOperation secondaryIndexOperation = findSecondaryIndexOperation(index, expressionWhere, table);
if (secondaryIndexOperation != null) {
result = secondaryIndexOperation;
break;
}
}
}
}
where.setIndexOperation(result);
Expression filterPk = findFiltersOnPrimaryKey(table, table.name, expressionWhere);
where.setPrimaryKeyFilter(filterPk);
}
示例13: findPrimaryKeyIndexSeek
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
private SQLRecordKeyFunction findPrimaryKeyIndexSeek(Expression where, Table table, String tableAlias) throws StatementExecutionException {
return findIndexAccess(where, table.primaryKey, table, tableAlias, EqualsTo.class
);
}
示例14: findSecondaryIndexOperation
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
private static IndexOperation findSecondaryIndexOperation(AbstractIndexManager index, Expression where, Table table) throws StatementExecutionException {
IndexOperation secondaryIndexOperation = null;
String[] columnsToMatch = index.getColumnNames();
SQLRecordKeyFunction indexSeekFunction = findIndexAccess(where, columnsToMatch,
index.getIndex(),
table.name,
EqualsTo.class
);
if (indexSeekFunction != null) {
if (indexSeekFunction.isFullPrimaryKey()) {
secondaryIndexOperation = new SecondaryIndexSeek(index.getIndexName(), columnsToMatch, indexSeekFunction);
} else {
secondaryIndexOperation = new SecondaryIndexPrefixScan(index.getIndexName(), columnsToMatch, indexSeekFunction);
}
} else {
SQLRecordKeyFunction rangeMin = findIndexAccess(where, columnsToMatch,
index.getIndex(),
table.name, GreaterThanEquals.class
);
if (rangeMin != null && !rangeMin.isFullPrimaryKey()) {
rangeMin = null;
}
if (rangeMin == null) {
rangeMin = findIndexAccess(where, columnsToMatch,
index.getIndex(),
table.name, GreaterThan.class
);
if (rangeMin != null && !rangeMin.isFullPrimaryKey()) {
rangeMin = null;
}
}
SQLRecordKeyFunction rangeMax = findIndexAccess(where, columnsToMatch,
index.getIndex(),
table.name, MinorThanEquals.class
);
if (rangeMax != null && !rangeMax.isFullPrimaryKey()) {
rangeMax = null;
}
if (rangeMax == null) {
rangeMax = findIndexAccess(where, columnsToMatch,
index.getIndex(),
table.name, MinorThan.class
);
if (rangeMax != null && !rangeMax.isFullPrimaryKey()) {
rangeMax = null;
}
}
if (rangeMin != null || rangeMax != null) {
secondaryIndexOperation = new SecondaryIndexRangeScan(index.getIndexName(), columnsToMatch, rangeMin, rangeMax);
}
}
return secondaryIndexOperation;
}
示例15: compileSpecialBinaryExpression
import net.sf.jsqlparser.expression.operators.relational.EqualsTo; //导入依赖的package包/类
private static CompiledSQLExpression compileSpecialBinaryExpression(String validatedTableAlias, Expression exp) {
BinaryExpression be = (BinaryExpression) exp;
// MOST frequent expressions "TABLE.COLUMNNAME OPERATOR ?", we can hardcode the access to the column and to the JDBC parameter
if (be.getLeftExpression() instanceof net.sf.jsqlparser.schema.Column) {
net.sf.jsqlparser.schema.Column c = (net.sf.jsqlparser.schema.Column) be.getLeftExpression();
if (validatedTableAlias != null) {
if (c.getTable() != null && c.getTable().getName() != null
&& !c.getTable().getName().equals(validatedTableAlias)) {
return null;
}
}
String columnName = c.getColumnName();
switch (columnName) {
case BuiltinFunctions.BOOLEAN_TRUE:
return null;
case BuiltinFunctions.BOOLEAN_FALSE:
return null;
default:
// OK !
break;
}
if (be.getRightExpression() instanceof JdbcParameter) {
JdbcParameter jdbcParam = (JdbcParameter) be.getRightExpression();
int jdbcIndex = jdbcParam.getIndex() - 1;
if (be instanceof EqualsTo) {
return new ColumnEqualsJdbcParameter(be.isNot(), columnName, jdbcIndex);
} else if (be instanceof NotEqualsTo) {
return new ColumnNotEqualsJdbcParameter(be.isNot(), columnName, jdbcIndex);
} else if (be instanceof GreaterThanEquals) {
return new ColumnGreaterThanEqualsJdbcParameter(be.isNot(), columnName, jdbcIndex);
} else if (be instanceof GreaterThan) {
return new ColumnGreaterThanJdbcParameter(be.isNot(), columnName, jdbcIndex);
} else if (be instanceof MinorThan) {
return new ColumnMinorThanJdbcParameter(be.isNot(), columnName, jdbcIndex);
} else if (be instanceof MinorThanEquals) {
return new ColumnMinorThanEqualsJdbcParameter(be.isNot(), columnName, jdbcIndex);
}
} // TODO handle "TABLE.COLUMNNAME OPERATOR CONSTANT"
}
return null;
}