Package org.teiid.query.sql.proc

Examples of org.teiid.query.sql.proc.CommandStatement


            +"select * from xmltest.doc1 where node1 = x; " //$NON-NLS-1$
            +"end "; //$NON-NLS-1$

        CreateUpdateProcedureCommand command = (CreateUpdateProcedureCommand) helpResolve(sql);
       
        CommandStatement cmdStmt = (CommandStatement)command.getBlock().getStatements().get(1);
       
        CompareCriteria criteria = (CompareCriteria)((Query)cmdStmt.getCommand()).getCriteria();
       
        assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)criteria.getRightExpression()).getGroupSymbol().getCanonicalName());
    }
View Full Code Here


     *  Constants will now auto resolve if they are consistently representable in the target type
     */
    @Test public void testDefect23257() throws Exception{
      CreateUpdateProcedureCommand command = helpResolve("EXEC pm5.vsp59()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
       
        CommandStatement cs = (CommandStatement)command.getBlock().getStatements().get(1);
       
        Insert insert = (Insert)cs.getCommand();
       
        assertEquals(DataTypeManager.DefaultDataClasses.SHORT, ((Expression)insert.getValues().get(1)).getType());
    }
View Full Code Here

                }
              break;
            }
      case Statement.TYPE_COMMAND:
            {
        CommandStatement cmdStmt = (CommandStatement) statement;
                Command command = cmdStmt.getCommand();
        ProcessorPlan commandPlan = cmdStmt.getCommand().getProcessorPlan();               
               
        if (command.getType() == Command.TYPE_DYNAMIC){
          instruction = new ExecDynamicSqlInstruction(parentProcCommand,((DynamicCommand)command), metadata, idGenerator, capFinder );
        }else{
          instruction = new CreateCursorResultSetInstruction(CreateCursorResultSetInstruction.RS_NAME, commandPlan,
View Full Code Here

          expr = rewriteExpressionDirect(expr);
                  exprStmt.setExpression(expr);
        }
        return exprStmt;
            case Statement.TYPE_COMMAND:
        CommandStatement cmdStmt = (CommandStatement) statement;
                rewriteSubqueryContainer(cmdStmt, false);
               
        if(cmdStmt.getCommand().getType() == Command.TYPE_UPDATE) {
                    Update update = (Update)cmdStmt.getCommand();
                    if (update.getChangeList().isEmpty()) {
                        return null;
                    }
        }
                return statement;
View Full Code Here

   */
  private Command asLoopProcedure(GroupSymbol group, Query query,
      ProcedureContainer newUpdate) throws QueryResolverException,
      TeiidComponentException, TeiidProcessingException {
    Block b = new Block();
    b.addStatement(new CommandStatement(newUpdate));
    CreateUpdateProcedureCommand cupc = new CreateUpdateProcedureCommand();
    Block parent = new Block();
    LoopStatement ls = new LoopStatement(b, query, "X"); //$NON-NLS-1$
    parent.addStatement(ls);
    AssignmentStatement as = new AssignmentStatement();
View Full Code Here

                if(ifStmt.hasElseBlock()) {
                    resolveBlock(command, ifStmt.getElseBlock(), externalGroups, metadata);
                }
                break;
            case Statement.TYPE_COMMAND:
                CommandStatement cmdStmt = (CommandStatement) statement;
                Command subCommand = cmdStmt.getCommand();
               
                TempMetadataStore discoveredMetadata = resolveEmbeddedCommand(metadata, externalGroups, subCommand);
               
                if (subCommand instanceof StoredProcedure) {
                  StoredProcedure sp = (StoredProcedure)subCommand;
View Full Code Here

      
    @Test public void testCommandStatement() throws Exception {
        Query query = sampleQuery();
       
        Command sqlCmd = query;
        CommandStatement cmdStmt = new CommandStatement(sqlCmd);
  
        helpStmtTest("SELECT a1 FROM g WHERE a2 = 5;", "SELECT a1 FROM g WHERE a2 = 5;", //$NON-NLS-1$ //$NON-NLS-2$
        cmdStmt);      
    }
View Full Code Here

        sqlCmd.setAsColumns(symbols);
        sqlCmd.setAsClauseSet(true);
       
        sqlCmd.setIntoGroup(new GroupSymbol("#g")); //$NON-NLS-1$
       
        CommandStatement cmdStmt = new CommandStatement(sqlCmd);
  
        helpStmtTest("exec string 'SELECT a1 FROM g WHERE a2 = 5' as a1 string into #g;", "EXECUTE 'SELECT a1 FROM g WHERE a2 = 5' AS a1 string INTO #g;", //$NON-NLS-1$ //$NON-NLS-2$
        cmdStmt);      
    }
View Full Code Here

       
        sqlCmd.setIntoGroup(new GroupSymbol("#g")); //$NON-NLS-1$
       
        sqlCmd.setUpdatingModelCount(1);
       
        CommandStatement cmdStmt = new CommandStatement(sqlCmd);
  
        helpStmtTest("execute string z as a1 string, a2 integer into #g update 1;", "EXECUTE z AS a1 string, a2 integer INTO #g UPDATE 1;", //$NON-NLS-1$ //$NON-NLS-2$
        cmdStmt);      
    }
View Full Code Here

        Expression sql = new ElementSymbol("z"); //$NON-NLS-1$
       
        sqlCmd.setSql(sql);
        sqlCmd.setUsing(using);
       
        CommandStatement cmdStmt = new CommandStatement(sqlCmd);
  
        helpStmtTest("execute immediate z using a=b;", "EXECUTE z USING a = b;", //$NON-NLS-1$ //$NON-NLS-2$
        cmdStmt);      
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.proc.CommandStatement

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.