コード例 #1
0
 /**
  * Create an execution object for the specified command
  *
  * @param command the command
  * @param executionContext Provides information about the context that this command is executing
  *     within, such as the identifiers for the command being executed
  * @param metadata Access to runtime metadata if needed to translate the command
  * @param connection connection factory object to the data source
  * @return An execution object that can use to execute the command
  */
 public Execution createExecution(
     Command command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection)
     throws TranslatorException {
   if (command instanceof Call) {
     Call obj = (Call) command;
     // TODO: our extension property support in designer makes ad-hoc properties impossible, so
     // we just match based upon name.  it would be better to have the metadatarepository/tooling
     // add a teiid property
     // to explicitly set this proc as direct.
     // the other approach would be to addd a native system stored procedure, but that would
     // require
     // special security semantics, whereas this proc can be secured on a schema basis
     if (supportsNativeQueries()
         && obj.getMetadataObject().getName().equals(getNativeQueryProcedureName())) {
       List<Argument> arguments = obj.getArguments();
       return createDirectExecution(arguments, command, executionContext, metadata, connection);
     }
   }
   if (command instanceof QueryExpression) {
     return createResultSetExecution(
         (QueryExpression) command, executionContext, metadata, connection);
   }
   if (command instanceof Call) {
     return createProcedureExecution((Call) command, executionContext, metadata, connection);
   }
   return createUpdateExecution(command, executionContext, metadata, connection);
 }
コード例 #2
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]);
 }