本文整理汇总了PHP中OA_Dal::quoteInterval方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal::quoteInterval方法的具体用法?PHP OA_Dal::quoteInterval怎么用?PHP OA_Dal::quoteInterval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Dal
的用法示例。
在下文中一共展示了OA_Dal::quoteInterval方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _pruneDataSummaryAdZoneAssocOldData
/**
* A method to prune the data_summary_ad_zone_assoc table
* Pruning can be performed where zone_id = 0 (i.e. for direct selection) and where the entry is older than MAX_PREVIOUS_AD_DELIVERY_INFO_LIMIT minutes ago.
*
* @return integer : number of records deleted
*/
function _pruneDataSummaryAdZoneAssocOldData()
{
$doDSAZA = OA_Dal::factoryDO('data_summary_ad_zone_assoc');
$doDSAZA->whereAdd('zone_id=0', 'AND');
$doDSAZA->whereAdd('created < DATE_ADD(' . $this->oDbh->quote(OA::getNow()) . ', ' . OA_Dal::quoteInterval(-MAX_PREVIOUS_AD_DELIVERY_INFO_LIMIT, 'SECOND') . ')', 'AND');
return $doDSAZA->delete(true, false);
}
示例2: getZonesForecasts
/**
* Get all zones forecasts by querying last hour's impressions for each zone
* This function will look at the hour before the specified OI
* to determine how much traffic to expected in the specified OI.
*
* @param string $intervalStart Interval start date of OI to forecast
* @param string $intervalEnd Interval end date of OI to forecast
* @return array array( zoneId => forecastForThisZone, ... )
*/
public function getZonesForecasts($intervalStart, $intervalEnd)
{
OA::debug(' - Selecting Zones forecasts for all managers for OI from ' . $intervalStart . ' to ' . $intervalEnd, PEAR_LOG_INFO);
$operationInterval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'];
$oneHourInterval = OA_Dal::quoteInterval(1, 'hour');
$query = "SELECT\n d.zone_id AS zone_id,\n sum(impressions) AS impressions,\n count(DISTINCT operation_interval_id) as count\n FROM\n {$this->_getTablename('data_intermediate_ad')} AS d\n WHERE\n d.operation_interval = '{$operationInterval}'\n AND d.date_time < '{$intervalStart}'\n AND d.date_time >= DATE_SUB('{$intervalStart}', {$oneHourInterval})\n GROUP BY d.zone_id\n ORDER BY zone_id\n ";
$rc = $this->oDbh->query($query);
$aResult = array();
while ($aRow = $rc->fetchRow()) {
// we divide by count in the case where we picked up several OIs that last less than one hour
$aResult[$aRow['zone_id']] = round($aRow['impressions'] / $aRow['count']);
}
return $aResult;
}