Exemplo n.º 1
0
 /**
  * @since 1.9
  *
  * @return number
  */
 public function getUsedPropertiesCount()
 {
     $count = 0;
     $row = $this->dbConnection->selectRow(array($this->store->getStatisticsTable()), 'Count( * ) AS count', array('usage_count > 0'), __METHOD__);
     $count = $row ? $row->count : $count;
     return (int) $count;
 }
Exemplo n.º 2
0
 /**
  * @since 1.9
  *
  * @return array
  */
 protected function doQuery()
 {
     Profiler::In(__METHOD__);
     // the query needs to do the filtering of internal properties, else LIMIT is wrong
     $options = array('ORDER BY' => 'smw_sortkey');
     if ($this->requestOptions !== null) {
         if ($this->requestOptions->limit > 0) {
             $options['LIMIT'] = $this->requestOptions->limit;
             $options['OFFSET'] = max($this->requestOptions->offset, 0);
         }
     }
     $conditions = array('smw_namespace' => SMW_NS_PROPERTY, 'smw_iw' => '');
     $conditions['usage_count'] = 0;
     $res = $this->dbConnection->select(array($this->store->getObjectIds()->getIdTable(), $this->store->getStatisticsTable()), array('smw_title', 'usage_count'), $conditions, __METHOD__, $options, array($this->store->getObjectIds()->getIdTable() => array('INNER JOIN', array('smw_id=p_id'))));
     Profiler::Out(__METHOD__);
     return $res;
 }