Package org.teiid.query.sql.lang

Examples of org.teiid.query.sql.lang.Update


        GroupSymbol g = new GroupSymbol("x"); //$NON-NLS-1$
        From from = new From();
        from.addGroup(g);

        ElementSymbol e =  new ElementSymbol("foo"); //$NON-NLS-1$
        Update query = new Update();
        query.setGroup(g);
        query.addChange(e, new Constant("bar", String.class)); //$NON-NLS-1$
       
        helpTest("update x set \"foo\"='bar'"//$NON-NLS-1$
                 "UPDATE x SET foo = 'bar'"//$NON-NLS-1$
                 query);               
   
View Full Code Here


              if (expr != null) {
                return shouldExecute(expr, simplifyCriteria);
              }
              return true;
            case Command.TYPE_UPDATE:
                Update update = (Update) command;
               
                if (update.getChangeList().isEmpty()) {
                    return false;
                }
               
                criteria = update.getCriteria();
                // If there are elements present in the criteria,
                // then we don't know the result, so assume we need to execute
                if (criteria == null) {
                  return true;
                }
                if(!EvaluatableVisitor.isFullyEvaluatable(criteria, duringPlanning)) {
                    return true;
                } else if(Evaluator.evaluate(criteria)) {
                    if (simplifyCriteria) {
                        update.setCriteria(null);
                    }
                    return true;
                }
                break;
            case Command.TYPE_DELETE:
View Full Code Here

        unaryFromClause.setOptional(true);
        helpTest(unaryFromClause, "/*+ optional */ m.g1");     //$NON-NLS-1$
    }
 
  public void testUpdate1() {
    Update update = new Update();
    update.setGroup(new GroupSymbol("m.g1"));     //$NON-NLS-1$
    update.addChange(new ElementSymbol("e1"), new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
   
    helpTest(update, "UPDATE m.g1 SET e1 = 'abc'"); //$NON-NLS-1$
  }
View Full Code Here

   
    helpTest(update, "UPDATE m.g1 SET e1 = 'abc'"); //$NON-NLS-1$
  }
 
  public void testUpdate2() {
    Update update = new Update();
    update.setGroup(new GroupSymbol("m.g1"));     //$NON-NLS-1$
    update.addChange(new ElementSymbol("e1"), new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
    update.addChange(new ElementSymbol("e2"), new Constant("xyz")); //$NON-NLS-1$ //$NON-NLS-2$
   
    helpTest(update, "UPDATE m.g1 SET e1 = 'abc', e2 = 'xyz'"); //$NON-NLS-1$
  }
View Full Code Here

     helpTestGroups(insert, true, groups);
  }

  public void testUpdate() {
    GroupSymbol gs1 = exampleGroupSymbol(1);
     Update update = new Update();
     update.setGroup(gs1);
    
     Set groups = new HashSet();
     groups.add(gs1);
     helpTestGroups(update, true, groups);
  }
View Full Code Here

        GroupSymbol g1 = exampleGroupSymbol(1);
        GroupSymbol g2 = exampleGroupSymbol(2);
        GroupSymbol g3 = exampleGroupSymbol(3);
        Insert insert = new Insert();
        insert.setGroup(g1);
        Update update = new Update();
        update.setGroup(g2);
        Delete delete = new Delete();
        delete.setGroup(g3);
       
        List updates = new ArrayList(3);
        updates.add(insert);
View Full Code Here

    UnaryFromClause ufc = new UnaryFromClause(exampleGroup(true, 0));
    helpTest(ufc, getSymbolMap());   
  }
 
  public void testVisitUpdate1() {
    Update update = new Update();
    update.setGroup(exampleGroup(true, 0));
    update.addChange(exampleElement(true, 0), new Constant("abc"));    //$NON-NLS-1$
    update.addChange(exampleElement(true, 1), new Constant("abc"));    //$NON-NLS-1$
    helpTest(update, getSymbolMap());
  }
View Full Code Here

    update.addChange(exampleElement(true, 1), new Constant("abc"));    //$NON-NLS-1$
    helpTest(update, getSymbolMap());
  }

  public void testVisitUpdate2() {
    Update update = new Update();
    update.setGroup(exampleGroup(true, 0));
    update.addChange(exampleElement(true, 0), new Constant("abc"));    //$NON-NLS-1$
    update.addChange(exampleElement(true, 1), new Constant("abc"));    //$NON-NLS-1$
    update.setCriteria(new CompareCriteria(exampleElement(true, 2), CompareCriteria.LT, new Constant("xyz"))); //$NON-NLS-1$
    helpTest(update, getSymbolMap());
  }
View Full Code Here

   
    helpTest(update, "UPDATE m.g1 SET e1 = 'abc', e2 = 'xyz'"); //$NON-NLS-1$
  }
 
  public void testUpdate3() {
    Update update = new Update();
    update.setGroup(new GroupSymbol("m.g1"));     //$NON-NLS-1$
    update.addChange(new ElementSymbol("e1"), new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
      update.setCriteria(new CompareCriteria(
            new ElementSymbol("e2"), //$NON-NLS-1$
            CompareCriteria.EQ,
            new Constant("abc")) ); //$NON-NLS-1$
   
   
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.lang.Update

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.