public function runQueries()
{
if (empty($this->reqs)) {
$this->error = 'no queries defined, issue addQuery() first';
return false;
}
// mbstring workaround
$this->mbPush();
if (!($fp = $this->connect())) {
$this->mbPop();
return false;
}
// send query, get response
$nreqs = count($this->reqs);
$req = implode('', $this->reqs);
$len = 8 + strlen($req);
// add header
$req = pack('nnNNN', self::SEARCHD_COMMAND_SEARCH, self::VER_COMMAND_SEARCH, $len, 0, $nreqs) . $req;
if (!$this->send($fp, $req, $len + 8) || !($response = $this->getResponse($fp, self::VER_COMMAND_SEARCH))) {
$this->mbPop();
return false;
}
// query sent ok; we can reset reqs now
$this->reqs = array();
// parse and return response
return $this->parseSearchResponse($response, $nreqs);
}