Exemplo n.º 1
0
 private function selectPropertiesFromTable()
 {
     // the query needs to do the filtering of internal properties, else LIMIT is wrong
     $options = array('ORDER BY' => 'smw_sortkey');
     $conditions = array('smw_namespace' => SMW_NS_PROPERTY, 'smw_iw' => '');
     if ($this->requestOptions->limit > 0) {
         $options['LIMIT'] = $this->requestOptions->limit;
         $options['OFFSET'] = max($this->requestOptions->offset, 0);
     }
     if ($this->requestOptions->getStringConditions()) {
         $conditions[] = $this->store->getSQLConditions($this->requestOptions, '', 'smw_title', false);
     }
     $res = $this->store->getConnection('mw.db')->select($this->store->getObjectIds()->getIdTable(), array('smw_id', 'smw_title'), $conditions, __METHOD__, $options);
     return $res;
 }
 private function doQueryPropertyTable()
 {
     // the query needs to do the filtering of internal properties, else LIMIT is wrong
     $options = array('ORDER BY' => 'smw_sortkey');
     $conditions = array('smw_namespace' => SMW_NS_PROPERTY, 'smw_iw' => '');
     if ($this->requestOptions->limit > 0) {
         $options['LIMIT'] = $this->requestOptions->limit;
         $options['OFFSET'] = max($this->requestOptions->offset, 0);
     }
     if ($this->requestOptions->getStringConditions()) {
         $conditions[] = $this->store->getSQLConditions($this->requestOptions, '', 'smw_sortkey', false);
     }
     $db = $this->store->getConnection('mw.db');
     $res = $db->select(array($db->tableName(SQLStore::ID_TABLE), $db->tableName(SQLStore::PROPERTY_STATISTICS_TABLE)), array('smw_title', 'usage_count'), $conditions, __METHOD__, $options, array($db->tableName(SQLStore::ID_TABLE) => array('INNER JOIN', array('smw_id=p_id'))));
     return $res;
 }