Examples of Delete


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

            final Update update = (Update)command;
            final Criteria crit = update.getCriteria();
            return table.update(crit, update.getChangeList());
          }
          if (command instanceof Delete) {
            final Delete delete = (Delete)command;
            final Criteria crit = delete.getCriteria();
            if (crit == null) {
              //because we are non-transactional, just use a truncate
              int rows = table.truncate();
                    return CollectionTupleSource.createUpdateCountTupleSource(rows);
            }
View Full Code Here

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

  private Command createDeleteProcedure(Delete delete, Query query,
      GroupSymbol group, String correlationName)
      throws TeiidComponentException, QueryMetadataException,
      QueryResolverException, TeiidProcessingException {
    Delete newUpdate = new Delete();
    newUpdate.setGroup(group.clone());
    List<Criteria> pkCriteria = createPkCriteria(group, correlationName, query);
    newUpdate.setCriteria(new CompoundCriteria(pkCriteria));
    return asLoopProcedure(delete.getGroup(), query, newUpdate);
  }
View Full Code Here

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

     */
    public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata)
        throws QueryMetadataException, QueryResolverException, TeiidComponentException {

        //Cast to known type
        Delete delete = (Delete) command;

        Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
        groups.add(delete.getGroup());
        QueryResolver.resolveSubqueries(command, metadata, groups);
        ResolverVisitor.resolveLanguageObject(delete, groups, delete.getExternalGroupContexts(), metadata);
    }
View Full Code Here

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

   
        helpTest(comp, "(m.g.c1 = 'abc') OR (<undefined>)"); //$NON-NLS-1$
    }       
   
    public void testDelete1() {
      Delete delete = new Delete();
      delete.setGroup(new GroupSymbol("m.g"));     //$NON-NLS-1$
     
      helpTest(delete, "DELETE FROM m.g"); //$NON-NLS-1$
    }
View Full Code Here

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

     
      helpTest(delete, "DELETE FROM m.g"); //$NON-NLS-1$
    }

    public void testDelete2() {
      Delete delete = new Delete();
      delete.setGroup(new GroupSymbol("m.g"));    //$NON-NLS-1$
      delete.setCriteria(new CompareCriteria(
            new ElementSymbol("m.g.c1"), //$NON-NLS-1$
            CompareCriteria.EQ,
            new Constant("abc")) ); //$NON-NLS-1$
      
     
View Full Code Here

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

      CommandStatement cmdStmt =  new CommandStatement(q1);
    helpTest(cmdStmt, "SELECT x FROM g;"); //$NON-NLS-1$
    }
   
    public void testCommandStatement2() {
        Delete d1 = new Delete();
        d1.setGroup(new GroupSymbol("g")); //$NON-NLS-1$
      CommandStatement cmdStmt =  new CommandStatement(d1);
    helpTest(cmdStmt, "DELETE FROM g;"); //$NON-NLS-1$
    }
View Full Code Here

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

      CommandStatement cmdStmt =  new CommandStatement(d1);
    helpTest(cmdStmt, "DELETE FROM g;"); //$NON-NLS-1$
    }
   
    public void testBlock1() {
        Delete d1 = new Delete();
        d1.setGroup(new GroupSymbol("g")); //$NON-NLS-1$
      CommandStatement cmdStmt =  new CommandStatement(d1);
      AssignmentStatement assigStmt =  new AssignmentStatement(new ElementSymbol("a"), new Constant(new Integer(1))); //$NON-NLS-1$
      RaiseErrorStatement errStmt =  new RaiseErrorStatement(new Constant("My Error")); //$NON-NLS-1$
      Block b = new Block();
      b.addStatement(cmdStmt);
View Full Code Here

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

    }
   
    public void testBlock2() {     
    // construct If statement

        Delete d1 = new Delete();
        d1.setGroup(new GroupSymbol("g")); //$NON-NLS-1$
      CommandStatement cmdStmt =  new CommandStatement(d1);
      Block ifblock = new Block(cmdStmt);
    // construct If criteria     
    ElementSymbol sy1 = new ElementSymbol("x"); //$NON-NLS-1$
    List elmnts = new ArrayList(1);
View Full Code Here

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

    helpTest(b, "BEGIN\nDELETE FROM g;\nIF(HAS LIKE CRITERIA ON (x))\nBEGIN\nDELETE FROM g;\nEND\nERROR 'My Error';\nEND"); //$NON-NLS-1$
    }
   
    public void testIfStatement1() {
    // construct If block
        Delete d1 = new Delete();
        d1.setGroup(new GroupSymbol("g")); //$NON-NLS-1$
      CommandStatement cmdStmt =  new CommandStatement(d1);
      AssignmentStatement assigStmt =  new AssignmentStatement(new ElementSymbol("a"), new Constant(new Integer(1))); //$NON-NLS-1$
      RaiseErrorStatement errStmt =  new RaiseErrorStatement(new Constant("My Error")); //$NON-NLS-1$
      Block ifblock = new Block();
      ifblock.addStatement(cmdStmt);
View Full Code Here

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

    helpTest(ifStmt, "IF(HAS LIKE CRITERIA ON (x))\nBEGIN\nDELETE FROM g;\na = 1;\nERROR 'My Error';\nEND"); //$NON-NLS-1$
    }

    public void testIfStatement2() {
    // construct If block
        Delete d1 = new Delete();
        d1.setGroup(new GroupSymbol("g")); //$NON-NLS-1$
      CommandStatement cmdStmt =  new CommandStatement(d1);
      Block ifblock = new Block(cmdStmt);

    // construct If criteria     
    ElementSymbol sy1 = new ElementSymbol("x"); //$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.