Examples of CompiledXQuery


Examples of org.exist.xquery.CompiledXQuery

    }
  }
 
  private void execute(boolean isBefore, DBBroker broker, Txn transaction, QName functionName, XmldbURI ... urls) throws TriggerException {
    final XmldbURI src = urls[0];
    final CompiledXQuery compiledQuery = getScript(isBefore, broker, transaction, src);
   
    if (compiledQuery == null) {return;}
   
    ProcessMonitor pm = null;
   
    final XQueryContext context = compiledQuery.getContext();
        //execute the XQuery
        try {
         
        final UserDefinedFunction function = context.resolveFunction(functionName, urls.length);
        if (function != null) {
          final List<Expression> args = new ArrayList<Expression>(urls.length);
          for (int i = 0; i < urls.length; i++)
            args.add(new LiteralValue(context, new AnyURIValue(urls[i])));
         
          pm = broker.getBrokerPool().getProcessMonitor();
         
              context.getProfiler().traceQueryStart();
              pm.queryStarted(context.getWatchDog());
             
              final FunctionCall call = new FunctionCall(context, function);
              call.setArguments(args);
              call.analyze(new AnalyzeContextInfo());
          call.eval(NodeSet.EMPTY_SET);
        }
        } catch(final XPathException e) {
        TriggerStatePerThread.setTriggerRunningState(TriggerStatePerThread.NO_TRIGGER_RUNNING, this, null);
        TriggerStatePerThread.setTransaction(null);
          throw new TriggerException(PEPARE_EXCEIPTION_MESSAGE, e);
        } finally {
          if (pm != null) {
            context.getProfiler().traceQueryEnd(context);
            pm.queryCompleted(context.getWatchDog());
          }
        compiledQuery.reset();
        context.reset();
        }

        if (!isBefore) {
          TriggerStatePerThread.setTriggerRunningState(TriggerStatePerThread.NO_TRIGGER_RUNNING, this, null);
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

        final XmldbURI[] docs = new XmldbURI[] { XmldbURI.create(collection.getName()) };

        final XQuery xquery = broker.getXQueryService();
        final XQueryPool pool = xquery.getXQueryPool();
        XQueryContext context;
        CompiledXQuery compiled = pool.borrowCompiledXQuery(broker, source);
        if(compiled == null)
            {context = xquery.newContext(accessCtx);}
        else
            {context = compiled.getContext();}
        //context.setBackwardsCompatibility(xpathCompatible);
        context.setStaticallyKnownDocuments(docs);

        if (variableDecls.containsKey(Debuggee.PREFIX+":session")) {
          context.declareVariable(Debuggee.SESSION, variableDecls.get(Debuggee.PREFIX+":session"));
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

            final long start = System.currentTimeMillis();
            broker = brokerPool.get(user);
            final XQuery xquery = broker.getXQueryService();
            final XQueryContext context = xquery.newContext(accessCtx);
            setupContext(null, context);
            final CompiledXQuery expr = xquery.compile(context, query);
//            checkPragmas(context);
            LOG.debug("compilation took "  (System.currentTimeMillis() - start));
            return expr;
        } catch (final EXistException e) {
            throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

    private ResourceSet execute(XmldbURI[] docs,
    Sequence contextSet, CompiledExpression expression, String sortExpr)
    throws XMLDBException {
      final long start = System.currentTimeMillis();
        final CompiledXQuery expr = (CompiledXQuery)expression;
      final Subject preserveSubject = brokerPool.getSubject();
      DBBroker broker = null;
      Sequence result;
      final XQueryContext context = expr.getContext();
        try {
        broker = brokerPool.get(user);

        //context.setBackwardsCompatibility(xpathCompatible);
        context.setStaticallyKnownDocuments(docs);
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

  /* (non-Javadoc)
   * @see org.exist.xmldb.XQueryService#dump(org.exist.xmldb.CompiledExpression, java.io.Writer)
   */
  public void dump(CompiledExpression expression, Writer writer) throws XMLDBException {
      final CompiledXQuery expr = (CompiledXQuery)expression;
      expr.dump(writer);
  }
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.