/**
  * @since 2.5
  *
  * @param integer $sid
  * @param integer $pid
  *
  * @return false|string
  */
 public function read($sid, $pid)
 {
     $row = $this->connection->selectRow($this->searchTable->getTableName(), array('o_text'), array('s_id' => (int) $sid, 'p_id' => (int) $pid), __METHOD__);
     if ($row === false) {
         return false;
     }
     return $this->textSanitizer->sanitize($row->o_text);
 }
Пример #2
0
 /**
  * @since 2.1
  *
  * @param integer $id
  *
  * @return DIWikiPage|null
  */
 public function getDataItemForId($id)
 {
     if (!$this->cache->contains($id)) {
         $row = $this->connection->selectRow($this->tableName, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject'), array('smw_id' => $id), __METHOD__);
         if ($row === false) {
             return null;
         }
         $hash = HashBuilder::createHashIdFromSegments($row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject);
         $this->saveToCache($id, $hash);
     }
     return HashBuilder::newDiWikiPageFromHash($this->cache->fetch($id));
 }
 private function getIdInfoAsJson($webRequest, $id)
 {
     if ($id < 1 || $webRequest->getText('action') !== 'idlookup') {
         return '';
     }
     $row = $this->connection->selectRow(\SMWSql3SmwIds::TABLE_NAME, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject', 'smw_sortkey'), 'smw_id=' . $id, __METHOD__);
     return '<pre>' . $this->outputFormatter->encodeAsJson(array($id, $row)) . '</pre>';
 }
 private function canMatchById($id)
 {
     $row = $this->connection->selectRow(\SMWSQLStore3::ID_TABLE, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject'), array('smw_id' => $id), __METHOD__);
     if ($row === false) {
         return false;
     }
     $hash = HashBuilder::createHashIdFromSegments($row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject);
     $this->saveToCache($id, $hash);
     return true;
 }
 /**
  * @since 2.1
  *
  * @param integer $id
  *
  * @return DIWikiPage|null
  */
 public function getDataItemForId($id)
 {
     $poolCache = $this->inMemoryPoolCache->getPoolCacheFor('sql.store.dataitem.finder');
     if (!$poolCache->contains($id)) {
         $row = $this->connection->selectRow(\SMWSQLStore3::ID_TABLE, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject'), array('smw_id' => $id), __METHOD__);
         if ($row === false) {
             return null;
         }
         $hash = HashBuilder::createHashIdFromSegments($row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject);
         $this->saveToCache($id, $hash);
     }
     return HashBuilder::newDiWikiPageFromHash($poolCache->fetch($id));
 }
 private function select($title, $namespace)
 {
     $row = $this->connection->selectRow(self::TABLENAME, 'o_id', array('s_title' => $title, 's_namespace' => $namespace), __METHOD__);
     return $row !== false && isset($row->o_id) ? (int) $row->o_id : 0;
 }