Package com.alvazan.orm.parser.antlr

Examples of com.alvazan.orm.parser.antlr.ExpressionNode


    DirectCursor<IndexColumnInfo> cursor = getResultListImpl(alreadyJoinedViews, indexedColumn);
    return cursor;
  }
 
  public DirectCursor<IndexColumnInfo> getResultListImpl(Set<ViewInfo> alreadyJoinedViews, String indexedColumn) {
    ExpressionNode root = spiMeta.getASTTree();
    if(root == null) {
      ViewInfoImpl tableInfo = (ViewInfoImpl) spiMeta.getTargetViews().get(0);
      DboTableMeta tableMeta = tableInfo.getTableMeta();
      PartitionMeta partitionMeta = tableInfo.getPartition();
      DboColumnMeta partColMeta = null;
View Full Code Here


      throw new UnsupportedOperationException("bug, unsupported type="+type);
    }
  }

  private DirectCursor<IndexColumnInfo> processAndOr(ExpressionNode root, Set<ViewInfo> alreadyJoinedViews) {
    ExpressionNode left = root.getChild(ChildSide.LEFT);
    ExpressionNode right = root.getChild(ChildSide.RIGHT);
   
    DirectCursor<IndexColumnInfo> leftResults = processExpressionTree(left, alreadyJoinedViews);
    DirectCursor<IndexColumnInfo> rightResults = processExpressionTree(right, alreadyJoinedViews);
   
    JoinMeta joinMeta = left.getJoinMeta();
    ViewInfo leftView = joinMeta.getPrimaryJoinInfo().getPrimaryTable();
    JoinMeta joinMeta2 = right.getJoinMeta();
    ViewInfo rightView = joinMeta2.getPrimaryJoinInfo().getPrimaryTable();
   
    JoinType joinType = root.getJoinMeta().getJoinType();
    if(joinType == JoinType.INNER || joinType == JoinType.LEFT_OUTER) {
      //We need to proxy the right results to translate to the same primary key as the
View Full Code Here

  }
 
  private DirectCursor<IndexColumnInfo> processRangeExpression(ExpressionNode root, Set<ViewInfo> alreadyJoinedViews) {
    StateAttribute attr;
    if(root.getType() == NoSqlLexer.BETWEEN) {
      ExpressionNode grandChild = root.getChild(ChildSide.LEFT).getChild(ChildSide.LEFT);
      attr = (StateAttribute) grandChild.getState();
    } else if (root.getType() == NoSqlLexer.IN) {
      ExpressionNode grandChild = root.getChild(ChildSide.LEFT);
      attr = (StateAttribute) grandChild.getState();
    } else {
      attr = (StateAttribute) root.getChild(ChildSide.LEFT).getState();
    }
   
    DboColumnMeta info = attr.getColumnInfo();
View Full Code Here

        || root.getType() == NoSqlLexer.LE
        || root.isBetweenExpression()) {
      Key from = null;
      Key to = null;
      if(root.isBetweenExpression()) {
        ExpressionNode node = root.getGreaterThan();
        ExpressionNode node2 = root.getLessThan();
        from = createLeftKey(node, info);
        to = createRightKey(node2, info);
      } else if(root.getType() == NoSqlLexer.GT
          || root.getType() == NoSqlLexer.GE) {
        from = createLeftKey(root, info);
View Full Code Here

  private SpiMetaQuery newsetupByVisitingTreeImpl(String query, String targetTable, MetaLoader mgr, String errorMsg) {
    SpiMetaQueryImpl spiMetaQuery = factory.get();

    InfoForWiring wiring = new InfoForWiring(query, targetTable);
    MetaFacade facade = new MetaFacadeImpl(mgr, metaInfo);
    ExpressionNode newTree = compiler.compileSql(query, wiring, facade);
   
    List<ViewInfo> allViews = wiring.getAllViews();
    List<ViewInfo> joinedViews = wiring.getJoinedViews();
    List<ViewInfo> notYetJoinedViews = new ArrayList<ViewInfo>();
    for(ViewInfo view : allViews) {
View Full Code Here

  }
 
  //@Test
  public void testBetween() {
    String sql = "select p FROM MyTable as p where p.leftside between :asfd and :ff";
    ExpressionNode newTree = scanner.compileSql(sql, wiring, facade);
    String result = ""+newTree;
    Assert.assertEquals("(p.leftside between :asfd and :ff)", result);
  }
View Full Code Here

  }

  @Test
  public void testSimpleJoin() {
    String sql = "select a from Activity as a left join a.account as acc";
    ExpressionNode tree = scanner.compileSql(sql, wiring, facade);
    Assert.assertNull(tree);
  }
View Full Code Here

  }
 
  @Test
  public void testSimple() {
    String sql = "select p FROM MyTable as p";
    ExpressionNode newTree = scanner.compileSql(sql, wiring, facade);
    Assert.assertNull(newTree);
  }
View Full Code Here

  }

  @Test
  public void testOptimizeBetween2() {
    String sql = "select *  FROM TABLE as e WHERE e.numTimes >= :begin and e.numTimes < :to";
    ExpressionNode newTree = scanner.compileSql(sql, wiring, facade);
    String result = ""+newTree;
    Assert.assertEquals(":begin <= e.numTimes < :to", result);
  }
View Full Code Here

  }
 
  @Test
  public void testOptimizeBetween() {
    String sql = "select p FROM MyTable as p where p.leftside > :asfd and p.rightside >= :ff and p.rightside < :tttt and p.leftside <= :fdfd";
    ExpressionNode newTree = scanner.compileSql(sql, wiring, facade);
    String result = ""+newTree;
    Assert.assertEquals("(:asfd < p.leftside <= :fdfd and :ff <= p.rightside < :tttt)", result);
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.parser.antlr.ExpressionNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.