/** @var $partialQuery CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery */
if (!$this->_table || $this->_table == $partialQuery->getName()) {
if ($partialQuery->isActive()) {
- $this->_foundRows[$partialQuery->getName()] = $partialQuery->fillTempTable($this->_text, $this->_entityIDTableName, $this->_tableName, $this->_limitClause, $this->_limitDetailClause);
+ $result = $partialQuery->fillTempTable($this->_text, $this->_entityIDTableName, $this->_tableName, $this->_limitClause, $this->_limitDetailClause);
+ $this->_foundRows[$partialQuery->getName()] = $result['count'];
}
}
}
* NULL if no limit; or array(0 => $limit, 1 => $offset)
* @param array|NULL $detailLimit final limit (applied when building $detailTable)
* NULL if no limit; or array(0 => $limit, 1 => $offset)
- * @return int number of matches
+ * @return array keys: match-descriptor
+ * - count: int
*/
public abstract function fillTempTable($queryText, $entityIDTableName, $detailTable, $queryLimit, $detailLimit);
/**
* @param string $queryText
- * @param array $tables
- * @return int the total number of matches
+ * @param array $tables a list of places to query. Keys may be:
+ * - sql: an array of SQL queries to execute
+ * - final: an array of SQL queries to execute at the end
+ * - *: All other keys are treated as table names
+ * @return array keys: match-descriptor
+ * - count: int
*/
function runQueries($queryText, &$tables, $entityIDTableName, $limit) {
$sql = "TRUNCATE {$entityIDTableName}";
}
}
- $rowCount = "SELECT count(*) FROM {$entityIDTableName}";
- return CRM_Core_DAO::singleValueQuery($rowCount);
+ return array(
+ 'count' => CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM {$entityIDTableName}")
+ );
}
/**