Package org.teiid.language

Examples of org.teiid.language.Call


      return new int [] {0};
    }
   
    @Override
    public List<?> getOutputParameterValues() throws TranslatorException {
      Call proc = (Call)this.command;
      int count = proc.getReturnType() != null ? 1:0;
      for (Argument param : proc.getArguments()) {
      if (param.getDirection() == Direction.INOUT || param.getDirection() == Direction.OUT) {
        count++;
      }
    }
      return Arrays.asList(new Object[count]);
View Full Code Here


        super(command, connection, context, env);
    }

    @Override
    public void execute() throws TranslatorException {
      Call procedure = (Call)command;
        columnDataTypes = procedure.getResultSetColumnTypes();

        //translate command
        TranslatedCommand translatedComm = translateCommand(procedure);
       
        //create statement or CallableStatement and execute
        String sql = translatedComm.getSql();
        try{
            //create parameter index map
            CallableStatement cstmt = getCallableStatement(sql);
            this.results = this.executionFactory.executeStoredProcedure(cstmt, translatedComm, procedure.getReturnType());
            addStatementWarnings();
        }catch(SQLException e){
            throw new TranslatorException(e, JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", sql)); //$NON-NLS-1$
        }          
       
View Full Code Here

    }
       
    @Override
    public List<?> getOutputParameterValues() throws TranslatorException {
        try {
          Call proc = (Call)this.command;
          List<Object> result = new ArrayList<Object>();
          int paramIndex = 1;
          if (proc.getReturnType() != null) {
            addParameterValue(result, paramIndex++, proc.getReturnType());
          }
          for (Argument parameter : proc.getArguments()) {
            switch (parameter.getDirection()) {
            case IN:
              paramIndex++;
              break;
            case INOUT:
View Full Code Here

  }

  @Override
  public void execute(ProcedureExecutionParent procedureExecutionParent) throws TranslatorException {
    try {
      Call command = parent.getCommand();
      List<Argument> params = command.getArguments();
     
      Argument object = params.get(OBJECT);
      String objectName = (String) object.getArgumentValue().getValue();
     
      Argument start = params.get(STARTDATE);
View Full Code Here

  }
 
  @Override
  public void execute() throws TranslatorException {
    try {
      Call procedure = (Call) this.command;
      List<Argument> arguments = procedure.getArguments();
      String mdxQuery = (String) arguments.get(0).getArgumentValue().getValue();
      stmt = this.connection.createStatement();
     
      cellSet = stmt.executeOlapQuery(mdxQuery);
      CellSetAxis rows = this.cellSet.getAxes().get(Axis.ROWS.axisOrdinal());
View Full Code Here

    // this has two result set columns and 1 out parameter
    int total_columns = 3;
    StoredProcedure command = (StoredProcedure)helpGetCommand("{call pm2.spTest8(?)}", EXAMPLE_BQT); //$NON-NLS-1$     
    command.getInputParameters().get(0).setExpression(new Constant(1));
    Call proc = (Call)new LanguageBridgeFactory(EXAMPLE_BQT).translate(command);

    ProcedureBatchHandler pbh = new ProcedureBatchHandler(proc, exec);

    assertEquals(total_columns, pbh.padRow(Arrays.asList(null, null)).size());
View Full Code Here

    public TestParameterImpl(String name) {
        super(name);
    }

    public static Argument example(int index) throws Exception {
        Call procImpl = TestProcedureImpl.example();
        return procImpl.getArguments().get(index);
    }
View Full Code Here

    public void testGetProcedureName() throws Exception {
        assertEquals("sq3", example().getProcedureName()); //$NON-NLS-1$
    }

    public void testGetParameters() throws Exception {
        Call exec = example();
        assertNotNull(exec.getArguments());
        assertEquals(2, exec.getArguments().size());
    }
View Full Code Here

            for(int i=1; i<inputArgs; i++) {
                sql.append(", null");                 //$NON-NLS-1$
            }
        }
        sql.append(")"); //$NON-NLS-1$
        Call proc = (Call) transUtil.parseCommand(sql.toString());
        return proc;
    }
View Full Code Here

        assertEquals(modeledPrimitiveType, p.getPrimitiveTypeID());
       
    }

    public void testProcedureWithResultSet() throws Exception {
        Call proc = getProcedure("sptest.proc1", 4, CONNECTOR_METADATA_UTILITY);      //$NON-NLS-1$
        List params = proc.getArguments();
        assertEquals(4, params.size());
       
        checkParameter((Argument)params.get(0),
                       "in1", //$NON-NLS-1$
                       "sptest.proc1.in1", //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.teiid.language.Call

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.