Package org.teiid.query.sql.lang

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


    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

    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

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

    public void testIfStatement3() {
    // 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

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

    public void testCreateUpdateProcedure1() {
        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

      CreateUpdateProcedureCommand cup = new CreateUpdateProcedureCommand(b);
    helpTest(cup, "CREATE PROCEDURE\nBEGIN\nDELETE FROM g;\na = 1;\nERROR 'My Error';\nEND");       //$NON-NLS-1$
    }
   
    public void testCreateUpdateProcedure2() {
        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

      CreateUpdateProcedureCommand cup = new CreateUpdateProcedureCommand(b);
    helpTest(cup, "CREATE PROCEDURE\nBEGIN\nDELETE FROM g;\na = 1;\nERROR 'My Error';\nEND");       //$NON-NLS-1$
    }

    public void testCreateUpdateProcedure3() {
        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

                    }
                    return true;
                }
                break;
            case Command.TYPE_DELETE:
                Delete delete = (Delete) command;
                criteria = delete.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) {
                        delete.setCriteria(null);
                    }
                    return true;
                }
                break;
            default:
View Full Code Here

    CompareCriteria cc = new CompareCriteria(exampleElement(true, 0), CompareCriteria.EQ, exampleElement(true, 1));
    helpTest(cc, getSymbolMap());
  }
 
  public void testVisitDelete1() {
    Delete delete = new Delete(exampleGroup(true, 0));
    helpTest(delete, getSymbolMap());
  }
View Full Code Here

    Delete delete = new Delete(exampleGroup(true, 0));
    helpTest(delete, getSymbolMap());
  }
 
  public void testVisitDelete2() {
    Delete delete = new Delete(exampleGroup(true, 0));
    delete.setCriteria(new CompareCriteria(exampleElement(true, 0), CompareCriteria.EQ, exampleElement(true, 1)));
    helpTest(delete, getSymbolMap());
  }
View Full Code Here

TOP

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

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.