/** * Fetches all blob fields name_* at once for the current archive for performance reasons. * * @param string $name * * @return void */ public function preFetchBlob($name) { $this->setRequestedReport($name); $this->prepareArchive(); if (!$this->isThereSomeVisits) { return; } $tableBlob = $this->archiveProcessing->getTableArchiveBlobName(); $db = Zend_Registry::get('db'); $hasBlobs = $db->hasBlobDataType(); // select blobs w/ name like "$name_[0-9]+" w/o using RLIKE $nameEnd = strlen($name) + 2; $query = $db->query("SELECT value, name\n\t\t\t\t\t\t\t\tFROM {$tableBlob}\n\t\t\t\t\t\t\t\tWHERE idarchive = ?\n\t\t\t\t\t\t\t\t\tAND (name = ? OR\n\t\t\t\t\t\t\t\t\t\t\t(name LIKE ? AND SUBSTRING(name, {$nameEnd}, 1) >= '0'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t AND SUBSTRING(name, {$nameEnd}, 1) <= '9') )", array($this->idArchive, $name, $name . '%')); while ($row = $query->fetch()) { $value = $row['value']; $name = $row['name']; if ($hasBlobs) { $this->blobCached[$name] = $this->uncompress($value); if ($this->blobCached[$name] === false) { //throw new Exception("Error gzuncompress $name "); } } else { $this->blobCached[$name] = $value; } } }
/** * Fetches all blob fields name_* at once for the current archive for performance reasons. * * @return void */ public function preFetchBlob($name) { if (!$this->isThereSomeVisits) { return false; } $tableBlob = $this->archiveProcessing->getTableArchiveBlobName(); $db = Zend_Registry::get('db'); $query = $db->query("SELECT value, name\n\t\t\t\t\t\t\t\tFROM {$tableBlob}\n\t\t\t\t\t\t\t\tWHERE idarchive = ?\n\t\t\t\t\t\t\t\t\tAND name LIKE '{$name}%'", array($this->idArchive)); while ($row = $query->fetch()) { $value = $row['value']; $name = $row['name']; $this->blobCached[$name] = gzuncompress($value); } }
/** * Fetches all blob fields name_* at once for the current archive for performance reasons. * * @return false if no visits */ public function preFetchBlob($name) { $this->setRequestedReport($name); $this->prepareArchive(); if (!$this->isThereSomeVisits) { return; } $tableBlob = $this->archiveProcessing->getTableArchiveBlobName(); $db = Zend_Registry::get('db'); $hasBlobs = $db->hasBlobDataType(); $query = $db->query("SELECT value, name\n\t\t\t\t\t\t\t\tFROM {$tableBlob}\n\t\t\t\t\t\t\t\tWHERE idarchive = ?\n\t\t\t\t\t\t\t\t\tAND name LIKE '{$name}%'", array($this->idArchive)); while ($row = $query->fetch()) { $value = $row['value']; $name = $row['name']; if ($hasBlobs) { $this->blobCached[$name] = $this->uncompress($value); if ($this->blobCached[$name] === false) { //throw new Exception("Error gzuncompress $name "); } } else { $this->blobCached[$name] = $value; } } }