29 parent::__construct();
31 $this->_result =
false;
32 $this->_loadId =
null;
48 function insert($assocType, $assocId, $day, $time, $countryCode, $region, $cityName, $fileType, $loadId) {
50 'INSERT INTO usage_stats_temporary_records
51 (assoc_type, assoc_id, day, entry_time, country_id, region, city, file_type, load_id)
53 (?, ?, ?, ?, ?, ?, ?, ?, ?)',
79 if (!$this->_result || $this->_loadId != $loadId) {
81 $this->_loadId = $loadId;
86 if ($result->EOF)
return $returner;
87 $returner = $result->GetRowAssoc(
false);
99 return $this->
update(
'DELETE from usage_stats_temporary_records WHERE load_id = ?', array($loadId));
111 function deleteRecord($assocType, $assocId, $time, $loadId) {
112 return $this->
update(
'DELETE from usage_stats_temporary_records
113 WHERE assoc_type = ? AND assoc_id = ? AND entry_time = ? AND load_id = ?',
114 array((
int) $assocType, (
int) $assocId, $time, $loadId));
128 'SELECT assoc_type, assoc_id, day, country_id, region, city, file_type, load_id, count(metric) as metric
129 FROM usage_stats_temporary_records WHERE load_id = ?
130 GROUP BY assoc_type, assoc_id, day, country_id, region, city, file_type, load_id',