/** * @param $select * @param $from * @param $where * @param $orderBy * @param $groupBy * @param $sprintfField * @param Piwik_ArchiveProcessing $archiveProcessing * @param Piwik_RankingQuery|false $rankingQuery * @return int */ protected function archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, $sprintfField, $archiveProcessing, $rankingQuery = false) { // idaction field needs to be set in select clause before calling getSelectQuery(). // if a complex segmentation join is needed, the field needs to be propagated // to the outer select. therefore, $segment needs to know about it. $select = sprintf($select, $sprintfField); $bind = array(); // get query with segmentation $query = $archiveProcessing->getSegment()->getSelectQuery($select, $from, $where, $bind, $orderBy, $groupBy); // extend bindings $bind = array_merge(array($archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite), $query['bind']); // replace the rest of the %s $querySql = str_replace("%s", $sprintfField, $query['sql']); // apply ranking query if ($rankingQuery) { $querySql = $rankingQuery->generateQuery($querySql); } // echo '<pre>';var_dump($querySql); // var_dump($bind); // get result $resultSet = $archiveProcessing->db->query($querySql, $bind); $modified = Piwik_Actions_ArchivingHelper::updateActionsTableWithRowQuery($resultSet, $sprintfField, $this->actionsTablesByType); return $modified; }
/** * @param $select * @param $from * @param $where * @param $orderBy * @param $groupBy * @param $sprintfField * @param Piwik_ArchiveProcessing $archiveProcessing * @return int */ protected function archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, $sprintfField, $archiveProcessing) { // idaction field needs to be set in select clause before calling getSelectQuery(). // if a complex segmentation join is needed, the field needs to be propagated // to the outer select. therefore, $segment needs to know about it. $select = sprintf($select, $sprintfField); // get query with segmentation $bind = array(); $orderBy = false; $query = $archiveProcessing->getSegment()->getSelectQuery($select, $from, $where, $bind, $orderBy, $groupBy); // replace the rest of the %s $querySql = str_replace("%s", $sprintfField, $query['sql']); // extend bindings $bind = array_merge(array($archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite), $query['bind']); // get result $resultSet = $archiveProcessing->db->query($querySql, $bind); $modified = $this->updateActionsTableWithRowQuery($resultSet, $sprintfField); return $modified; }