Пример #1
0
 /**
  * Build request for a select query
  *
  * @param  Query   $query
  * @return Request
  */
 public function build(QueryInterface $query)
 {
     $request = new Request();
     $request->setHandler($query->getHandler());
     $request->addParam('omitHeader', $query->getOmitHeader());
     $request->addParams($query->getParams());
     $request->addParam('wt', $query->getResponseWriter());
     return $request;
 }
Пример #2
0
 /**
  * Build request for a select query.
  *
  * @param QueryInterface|Query $query
  *
  * @return Request
  */
 public function build(QueryInterface $query)
 {
     $request = new Request();
     $request->setHandler($query->getHandler());
     $request->addParam('omitHeader', $query->getOmitHeader());
     $request->addParam('timeAllowed', $query->getTimeAllowed());
     $request->addParams($query->getParams());
     $request->addParam('wt', $query->getResponseWriter());
     if ($query->getResponseWriter() == $query::WT_JSON) {
         // only one JSON format is supported
         $request->addParam('json.nl', 'flat');
     }
     return $request;
 }
Пример #3
0
 /**
  * Build request for a stats.jsp query.
  *
  * @param QueryInterface $query
  * @return Request
  */
 public function build(QueryInterface $query)
 {
     $request = new Request();
     $request->setHandler($query->getHandler());
     return $request;
 }
Пример #4
0
 /**
  * Creates a result object
  *
  * @throws UnexpectedValueException;
  * @param  QueryInterface            $query
  * @param  array Response            $response
  * @return ResultInterface
  */
 public function createResult(QueryInterface $query, $response)
 {
     $event = new PreCreateResultEvent($query, $response);
     $this->eventDispatcher->dispatch(Events::PRE_CREATE_RESULT, $event);
     if ($event->getResult() !== null) {
         return $event->getResult();
     }
     $resultClass = $query->getResultClass();
     $result = new $resultClass($this, $query, $response);
     if (!$result instanceof ResultInterface) {
         throw new UnexpectedValueException('Result class must implement the ResultInterface');
     }
     $this->eventDispatcher->dispatch(Events::POST_CREATE_RESULT, new PostCreateResultEvent($query, $response, $result));
     return $result;
 }