Examples of QueryContext


Examples of com.caucho.db.sql.QueryContext

    _rs = null;

    if (rs != null)
      rs.close();

    QueryContext queryContext = _queryContext;
    _queryContext = null;
   
    if (queryContext != null)
      QueryContext.free(queryContext);
   
View Full Code Here

Examples of com.caucho.db.sql.QueryContext

    try {
      if (_count != 1)
        throw new IllegalStateException("Multithreading execute");

      xa = _conn.getTransaction();
      QueryContext queryContext = getQueryContext();

      if (_query.isSelect()) {
        _query.execute(queryContext, xa);

        _wasResultSet = true;
        _resultSet = new ResultSetImpl(this, queryContext.getResult());

        return true;
      }
      else {
        queryContext.setReturnGeneratedKeys(_isReturnGeneratedKeys);

        _query.execute(queryContext, xa);

        _wasResultSet = false;
        return false;
View Full Code Here

Examples of com.caucho.db.sql.QueryContext

    throws SQLException
  {
    SelectCursor cursor = _cursor;
    _cursor = null;
   
    QueryContext cxt = _cxt;
    _cxt = null;

    try {
      if (cursor != null)
        cursor.close();
    } catch (Exception e) {
      log.log(Level.FINER, e.toString(), e);
    }

    try {
      if (cxt != null)
        cxt.close();
    } catch (Exception e) {
      log.log(Level.FINER, e.toString(), e);
    }
  }
View Full Code Here

Examples of com.foundationdb.qp.operator.QueryContext

        }
    }

    protected List<Row> runPlanInternal(Session session, Schema schema, Operator plan) {
        StoreAdapter adapter = newStoreAdapter(session, schema);
        QueryContext context = queryContext(adapter);
        Cursor cursor = API.cursor(plan, context, context.createBindings());
        cursor.openTopLevel();
        try {
            List<Row> output = new ArrayList<>();
            Row row;
            while((row = cursor.next()) != null) {
View Full Code Here

Examples of com.kurento.kmf.orion.entities.QueryContext

   */
  public QueryContextResponse queryContext(String type, String id) {
    OrionContextElement element = new OrionContextElement();
    element.setId(id);
    element.setType(type);
    QueryContext query = new QueryContext(element);
    return sendRequestToOrion(query, QUERY_PATH, QueryContextResponse.class);
  }
View Full Code Here

Examples of org.apache.drill.exec.ops.QueryContext

 
  public Foreman(WorkerBee bee, DrillbitContext dContext, UserClientConnection connection, QueryId queryId,
      RunQuery queryRequest) {
    this.queryId = queryId;
    this.queryRequest = queryRequest;
    this.context = new QueryContext(queryId, dContext);
    this.initiatingClient = connection;
    this.fragmentManager = new RunningFragmentManager(new ForemanManagerListener(), new TunnelManager(dContext.getBitCom()));
    this.bee = bee;
   
    this.state = new AtomicState<QueryState>(QueryState.PENDING) {
View Full Code Here

Examples of org.apache.drill.exec.ops.QueryContext

      context.getAllocator(); result = BufferAllocator.getAllocator(c);
      context.getConfig(); result = c;
    }};
    RemoteServiceSet lss = RemoteServiceSet.getLocalServiceSet();
    DrillbitContext bitContext = new DrillbitContext(DrillbitEndpoint.getDefaultInstance(), context, coord, com, cache);
    QueryContext qc = new QueryContext(QueryId.getDefaultInstance(), bitContext);
    PhysicalPlanReader reader = bitContext.getPlanReader();
    LogicalPlan plan = reader.readLogicalPlan(Files.toString(FileUtils.getResourceAsFile(file), Charsets.UTF_8));
    PhysicalPlan pp = new BasicOptimizer(DrillConfig.create(), qc).optimize(new BasicOptimizer.BasicOptimizationContext(), plan);
   
View Full Code Here

Examples of org.apache.openjpa.kernel.QueryContext

                    new Object[]{ e.toString(), jpql }), e);
            }
        }

        void populate(ExpressionStoreQuery query) {
            QueryContext ctx = query.getContext();

            // if the owning query's context does not have
            // any candidate class, then set it here
            if (ctx.getCandidateType() == null) {
                if (_candidateType == null)
                    _candidateType = new JPQLExpressionBuilder
                        (null, query, this).getCandidateType();
                ctx.setCandidateType(_candidateType, true);
            }
        }
View Full Code Here

Examples of org.apache.openjpa.kernel.QueryContext

        private final boolean _select;
        private final boolean _call;   // native call stored procedure
        private final QueryResultMapping _resultMapping;

        public SQLExecutor(SQLStoreQuery q, ClassMetaData candidate) {
            QueryContext ctx = q.getContext();
            String resultMapping = ctx.getResultMappingName();
            if (resultMapping == null)
                _resultMapping = null;
            else {
                ClassLoader envLoader = ctx.getStoreContext().getClassLoader();
                MappingRepository repos = q.getStore().getConfiguration().
                    getMappingRepositoryInstance();
                _resultMapping = repos.getQueryResultMapping
                    (ctx.getResultMappingScope(), resultMapping, envLoader,
                        true);
            }
            _meta = candidate;

            String sql = StringUtils.trimToNull(ctx.getQueryString());
            if (sql == null)
                throw new UserException(_loc.get("no-sql"));
            _select = sql.length() > 6
                && sql.substring(0, 6).equalsIgnoreCase("select");
            _call = sql.length() > 4
View Full Code Here

Examples of org.apache.openjpa.kernel.QueryContext

        new ArrayList<Future<ResultObjectProvider>>();
            final List<Executor> usedExecutors = new ArrayList<Executor>();
      final List<ResultObjectProvider> rops =
        new ArrayList<ResultObjectProvider>();
      List<SliceStoreManager> targets = findTargets();
      QueryContext ctx = q.getContext();
      boolean isReplicated = containsReplicated(ctx);
            ExecutorService threadPool = SliceThread.getPool();
      for (int i = 0; i < owner._queries.size(); i++) {
                // if replicated, then execute only on single slice
        if (isReplicated && !usedExecutors.isEmpty()) {
          break;
        }
                StoreManager sm = owner.getDistributedStore().getSlice(i);
        if (!targets.contains(sm))
          continue;
        StoreQuery query = owner._queries.get(i);
        Executor executor = executors.get(i);
        if (!targets.contains(sm))
          continue;
        usedExecutors.add(executor);
                QueryExecutor call = new QueryExecutor();
                call.executor = executor;
                call.query = query;
                call.params = params;
                call.range = range;
                futures.add(threadPool.submit(call));
      }
      for (Future<ResultObjectProvider> future : futures) {
        try {
          rops.add(future.get());
        } catch (InterruptedException e) {
          throw new RuntimeException(e);
        } catch (ExecutionException e) {
          throw new StoreException(e.getCause());
        }
      }
     
      ResultObjectProvider[] tmp = rops
                    .toArray(new ResultObjectProvider[rops.size()]);
      ResultObjectProvider result = null;
      boolean[] ascending = getAscending(q);
      boolean isAscending = ascending.length > 0;
      boolean isAggregate = ctx.isAggregate();
      boolean hasRange = ctx.getEndRange() != Long.MAX_VALUE;
      if (isAggregate) {
        result = new UniqueResultObjectProvider(tmp, q,
            getQueryExpressions());
      } else if (isAscending) {
                result = new OrderingMergedResultObjectProvider(tmp, ascending,
                    usedExecutors.toArray(new Executor[usedExecutors.size()]),
          q, params);
      } else {
        result = new MergedResultObjectProvider(tmp);
      }
      if (hasRange) {
                result = new RangeResultObjectProvider(result,
                        ctx.getStartRange(), ctx.getEndRange());
      }
      return result;
    }
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.