Java Code Examples for net.sf.jsqlparser.expression.operators.relational.GreaterThan

The following examples show how to use net.sf.jsqlparser.expression.operators.relational.GreaterThan. These examples are extracted from open source projects. 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
public GreaterThanExpressionConverter(){
    setJsqlparserExpressionSupplier(new Supplier<GreaterThanExpression, GreaterThan>() {
        @Override
        public GreaterThan get(GreaterThanExpression input) {
            return new GreaterThan();
        }
    });
}
 
Example 2
@Override
public Class<GreaterThan> getJSqlParserExpressionClass() {
    return GreaterThan.class;
}
 
Example 3
@Override
public void visit(GreaterThan greaterThan) {
    visitBinaryExpression(greaterThan);
}
 
Example 4
Source Project: spanner-jdbc   Source File: DMLWhereClauseVisitorAdapter.java    License: MIT License 4 votes vote down vote up
@Override
public void visit(GreaterThan expr) {
  invalid = true;
  super.visit(expr);
}
 
Example 5
Source Project: genericdao   Source File: SqlServer.java    License: Artistic License 2.0 4 votes vote down vote up
/**
 * 获取一个外层包装的TOP查询
 *
 * @param select
 * @return
 */
private Select getPageSelect(Select select, String orderBy) {
    SelectBody selectBody = select.getSelectBody();
    if (selectBody instanceof SetOperationList) {
        selectBody = wrapSetOperationList((SetOperationList) selectBody);
    }
    //这里的selectBody一定是PlainSelect
    if (((PlainSelect) selectBody).getTop() != null) {
        throw new RuntimeException("被分页的语句已经包含了Top,不能再通过分页插件进行分页查询!");
    }
    //获取查询列
    List<SelectItem> selectItems = getSelectItems((PlainSelect) selectBody);
    //对一层的SQL增加ROW_NUMBER()
    addRowNumber((PlainSelect) selectBody, orderBy);
    //处理子语句中的order by
    processSelectBody(selectBody, 0);

    //新建一个select
    Select newSelect = new Select();
    PlainSelect newSelectBody = new PlainSelect();
    //设置top
    Top top = new Top();
    top.setRowCount(Long.MAX_VALUE);
    newSelectBody.setTop(top);
    //设置order by
    List<OrderByElement> orderByElements = new ArrayList<OrderByElement>();
    OrderByElement orderByElement = new OrderByElement();
    orderByElement.setExpression(PAGE_ROW_NUMBER_COLUMN);
    orderByElements.add(orderByElement);
    newSelectBody.setOrderByElements(orderByElements);
    //设置where
    GreaterThan greaterThan = new GreaterThan();
    greaterThan.setLeftExpression(PAGE_ROW_NUMBER_COLUMN);
    greaterThan.setRightExpression(new LongValue(Long.MIN_VALUE));
    newSelectBody.setWhere(greaterThan);
    //设置selectItems
    newSelectBody.setSelectItems(selectItems);
    //设置fromIterm
    SubSelect fromItem = new SubSelect();
    fromItem.setSelectBody(selectBody);
    fromItem.setAlias(PAGE_TABLE_ALIAS);
    newSelectBody.setFromItem(fromItem);

    newSelect.setSelectBody(newSelectBody);
    if (isNotEmptyList(select.getWithItemsList())) {
        newSelect.setWithItemsList(select.getWithItemsList());
    }
    return newSelect;
}
 
Example 6
Source Project: Mybatis-PageHelper   Source File: SqlServerParser.java    License: MIT License 4 votes vote down vote up
/**
 * 获取一个外层包装的TOP查询
 *
 * @param select
 * @return
 */
protected Select getPageSelect(Select select) {
    SelectBody selectBody = select.getSelectBody();
    if (selectBody instanceof SetOperationList) {
        selectBody = wrapSetOperationList((SetOperationList) selectBody);
    }
    //这里的selectBody一定是PlainSelect
    if (((PlainSelect) selectBody).getTop() != null) {
        throw new PageException("被分页的语句已经包含了Top,不能再通过分页插件进行分页查询!");
    }
    //获取查询列
    List<SelectItem> selectItems = getSelectItems((PlainSelect) selectBody);
    //对一层的SQL增加ROW_NUMBER()
    List<SelectItem> autoItems = new ArrayList<SelectItem>();
    SelectItem orderByColumn = addRowNumber((PlainSelect) selectBody, autoItems);
    //加入自动生成列
    ((PlainSelect) selectBody).addSelectItems(autoItems.toArray(new SelectItem[autoItems.size()]));
    //处理子语句中的order by
    processSelectBody(selectBody, 0);

    //中层子查询
    PlainSelect innerSelectBody = new PlainSelect();
    //PAGE_ROW_NUMBER
    innerSelectBody.addSelectItems(orderByColumn);
    innerSelectBody.addSelectItems(selectItems.toArray(new SelectItem[selectItems.size()]));
    //将原始查询作为内层子查询
    SubSelect fromInnerItem = new SubSelect();
    fromInnerItem.setSelectBody(selectBody);
    fromInnerItem.setAlias(PAGE_TABLE_ALIAS);
    innerSelectBody.setFromItem(fromInnerItem);

    //新建一个select
    Select newSelect = new Select();
    PlainSelect newSelectBody = new PlainSelect();
    //设置top
    Top top = new Top();
    top.setExpression(new LongValue(Long.MAX_VALUE));
    newSelectBody.setTop(top);
    //设置order by
    List<OrderByElement> orderByElements = new ArrayList<OrderByElement>();
    OrderByElement orderByElement = new OrderByElement();
    orderByElement.setExpression(PAGE_ROW_NUMBER_COLUMN);
    orderByElements.add(orderByElement);
    newSelectBody.setOrderByElements(orderByElements);
    //设置where
    GreaterThan greaterThan = new GreaterThan();
    greaterThan.setLeftExpression(PAGE_ROW_NUMBER_COLUMN);
    greaterThan.setRightExpression(new LongValue(Long.MIN_VALUE));
    newSelectBody.setWhere(greaterThan);
    //设置selectItems
    newSelectBody.setSelectItems(selectItems);
    //设置fromIterm
    SubSelect fromItem = new SubSelect();
    fromItem.setSelectBody(innerSelectBody); //中层子查询
    fromItem.setAlias(PAGE_TABLE_ALIAS);
    newSelectBody.setFromItem(fromItem);

    newSelect.setSelectBody(newSelectBody);
    if (isNotEmptyList(select.getWithItemsList())) {
        newSelect.setWithItemsList(select.getWithItemsList());
    }
    return newSelect;
}
 
Example 7
Source Project: quetzal   Source File: CTEToNestedQueryConverter.java    License: Eclipse Public License 2.0 2 votes vote down vote up
@Override
public void visit(GreaterThan greaterThan) {
	visitBinary(greaterThan, false);
	
	
}