Examples of Constant


Examples of org.teiid.query.sql.symbol.Constant

    if (!CapabilitiesUtil.useAnsiJoin(RuleRaiseAccess.getModelIDFromAccess(accessRoot, metadata), metadata, capFinder)) {
      simplifyFromClause(query);
        }
    if (columns.isEmpty()) {
          if (CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, RuleRaiseAccess.getModelIDFromAccess(accessRoot, metadata), metadata, capFinder)) {
            select.addSymbol(new ExpressionSymbol("dummy", new Constant(1))); //$NON-NLS-1$
          } else {
            //TODO: need to ensure the type is consistent 
            //- should be rare as the source would typically support select expression if it supports union
            select.addSymbol(selectOutputElement(query.getFrom().getGroups(), metadata));
          }
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

            if (newGroup != null) {
                ElementSymbol newElementSymbol = oldElementSymbol.clone();
                newElementSymbol.setGroupSymbol(newGroup);
                symbol = newElementSymbol;
            } else {
                symbol = new Constant(null, oldElementSymbol.getType());
            }
           
            // Update map
            map.put(oldElementSymbol, symbol);               
        }
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

    }

  private static Expression evaluateIfPossible(Expression newExpr) {
    if (EvaluatableVisitor.isFullyEvaluatable(newExpr, true)) {
          try {
        return new Constant(Evaluator.evaluate(newExpr), newExpr.getType());
      } catch (TeiidException e) {
        throw new TeiidRuntimeException(e, "Unexpected Exception"); //$NON-NLS-1$
      }
        }
        return newExpr;
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

       
        From from = new From();
        from.addGroup(new GroupSymbol("g")); //$NON-NLS-1$
       
        Criteria criteria = new CompareCriteria(new ElementSymbol("a2"), CompareCriteria.EQ,  //$NON-NLS-1$
            new Constant(new Integer(5)));
       
        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(criteria);
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

    }
   
    @Test public void testOpen_Defect16059() throws Exception {
      Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NULL", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
        IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
        nullCrit.setExpression(new Constant(null));
       
        helpTestOpen(query, "SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5", true); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

    }
   
    @Test public void testOpen_Defect16059_2() throws Exception {
      Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NOT NULL", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
        IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
        nullCrit.setExpression(new Constant(null));
       
        helpTestOpen(query, null, false);
    }
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

    @Test public void testShouldExecuteUpdate() throws Exception {
        Update update = new Update();
       
        update.setGroup(new GroupSymbol("test")); //$NON-NLS-1$
       
        update.addChange(new ElementSymbol("e1"), new Constant("1")); //$NON-NLS-1$ //$NON-NLS-2$
       
        assertTrue(RelationalNodeUtil.shouldExecute(update, false));
       
        update.setChangeList(new SetClauseList());
       
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

              IsNullCriteria isNull = (IsNullCriteria)theCrit;
              if (!isNull.isNegated() && isNull.getExpression() instanceof ElementSymbol) {
                if (srcToTgt == null) {
                  srcToTgt = new HashMap<Expression, Expression>();
                }
                srcToTgt.put(isNull.getExpression(), new Constant(null, isNull.getExpression().getType()));
              }
              continue;
            }
            if(!(theCrit instanceof CompareCriteria)) {
                continue;
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

    @Test public void testRewriteMatchCritEscapeChar4() {
        helpTestRewriteCriteria("pm1.g1.e1 LIKE pm1.g1.e1 ESCAPE '#'", "pm1.g1.e1 LIKE pm1.g1.e1 ESCAPE '#'"); //$NON-NLS-1$ //$NON-NLS-2$
    }
   
    @Test public void testRewriteMatchCritEscapeChar5() throws Exception {
        MatchCriteria mcrit = new MatchCriteria(new ElementSymbol("pm1.g1.e1"), new Constant(null, DataTypeManager.DefaultDataClasses.STRING), '#'); //$NON-NLS-1$
        Criteria expected = QueryRewriter.UNKNOWN_CRITERIA;
               
        Object actual = QueryRewriter.rewriteCriteria(mcrit, null, null, null);
        assertEquals("Did not get expected rewritten criteria", expected, actual); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.sql.symbol.Constant

        String expected = "pm1.g1.e4 = '1234.5'"; //$NON-NLS-1$
       
        FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
        Criteria origCrit = parseCriteria(original, metadata);
        Criteria expectedCrit = parseCriteria(expected, metadata);
        ((CompareCriteria)expectedCrit).setRightExpression(new Constant(new Double(1234.5)));
       
        // rewrite
        Criteria actual = QueryRewriter.rewriteCriteria(origCrit, null, null, null);
        assertEquals("Did not rewrite correctly: ", expectedCrit, actual); //$NON-NLS-1$
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.