Package org.teiid.language

Examples of org.teiid.language.Condition


   
    /**
     * @return
     */
    static Set getTickers(Select query) throws TranslatorException {
        Condition crit = query.getWhere();
        if(crit == null) {
            throw new TranslatorException(YahooPlugin.Util.getString("YahooExecution.Must_have_criteria")); //$NON-NLS-1$
        }
        return TickerCollectorVisitor.getTickers(crit);
    }
View Full Code Here


            buffer.append(Tokens.RPAREN);
        } else {
            append(rightItem);
        }
       
        final Condition condition = obj.getCondition();
        if (condition != null) {
            buffer.append(Tokens.SPACE)
                  .append(ON)
                  .append(Tokens.SPACE);
            append(condition);                   
View Full Code Here

  // even if the named entry doesn't exist (as long as its parent does
  // exist).
  private void executeDelete()
      throws TranslatorException {

    Condition criteria = ((Delete)command).getWhere();

    // since we have the exact same processing rules for criteria
    // for updates and deletes, we use a common private method to do this.
    // note that this private method will throw a ConnectorException
    // for illegal criteria, which we deliberately don't catch
View Full Code Here

  // on the "DN" column ("WHERE DN='cn=John Doe,ou=people,dc=company,dc=com'")
  private void executeUpdate()
      throws TranslatorException {

    List<SetClause> updateList = ((Update)command).getChanges();
    Condition criteria = ((Update)command).getWhere();

    // since we have the exact same processing rules for criteria
    // for updates and deletes, we use a common private method to do this.
    // note that this private method will throw a ConnectorException
    // for illegal criteria, which we deliberately don't catch
View Full Code Here

          return Arrays.asList(nullValue);
        } else if (!isNotNull(b)) {
          crits.add(langFactory.createIsNullCriteria(b, false));
        }
       
        Condition crit = null;
       
        if (crits.isEmpty()) {
          return null;
        } else if (crits.size() == 1) {
          crit = crits.get(0);
View Full Code Here

      }
     
      if (decompose) {
        Comparison.Operator opCode = obj.isNegated()?Comparison.Operator.NE:Comparison.Operator.EQ;
        if (exprs.size() > 1) {
          Condition left = LanguageFactory.INSTANCE.createCompareCriteria(opCode, obj.getLeftExpression(), exprs.get(0));
          for (int i = 1; i < exprs.size(); i++) {
            AndOr replace = LanguageFactory.INSTANCE.createAndOr(obj.isNegated()?Operator.AND:Operator.OR, left, LanguageFactory.INSTANCE.createCompareCriteria(opCode, obj.getLeftExpression(), exprs.get(i)));
            left = replace;
          }
          super.visit((AndOr)left);
View Full Code Here

    private Condition convertCriteria(String criteriaStr) {
        // Create ICriteria from criteriaStr
        TranslationUtility util = FakeTranslationFactory.getInstance().getBQTTranslationUtility();
        String sql = "SELECT IntKey FROM BQT1.SmallA WHERE " + criteriaStr; //$NON-NLS-1$
        Select query = (Select) util.parseCommand(sql);
        Condition criteria = query.getWhere();
        return criteria;
    }
View Full Code Here

        Condition criteria = query.getWhere();
        return criteria;
    }
   
    public void helpTestSeparateByAnd(String criteriaStr, String[] expected) throws Exception {
        Condition criteria = convertCriteria(criteriaStr);

        // Execute       
        List<Condition> crits = LanguageUtil.separateCriteriaByAnd(criteria);
       
        // Build expected and actual sets
View Full Code Here

                "SmallA.StringNum = '3'", //$NON-NLS-1$
                "SmallA.StringKey = '4'" }); //$NON-NLS-1$       
    }

    public void helpTestCombineCriteria(String primaryStr, String additionalStr, String expected) throws Exception {
        Condition primaryCrit = (primaryStr == null ? null : convertCriteria(primaryStr));
        Condition additionalCrit = (additionalStr == null ? null : convertCriteria(additionalStr));

        // Execute       
        Condition crit = LanguageUtil.combineCriteria(primaryCrit, additionalCrit, LanguageFactory.INSTANCE);
       
        // Compare
        String critStr = (crit == null ? null : crit.toString());
        assertEquals("Did not get expected criteria", expected, critStr); //$NON-NLS-1$
    }
View Full Code Here

TOP

Related Classes of org.teiid.language.Condition

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.