本文整理汇总了PHP中CM_Db_Db::execRead方法的典型用法代码示例。如果您正苦于以下问题:PHP CM_Db_Db::execRead方法的具体用法?PHP CM_Db_Db::execRead怎么用?PHP CM_Db_Db::execRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CM_Db_Db
的用法示例。
在下文中一共展示了CM_Db_Db::execRead方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _findByIp
/**
* @param int $ip
* @return CM_Model_Location|null
*/
private static function _findByIp($ip)
{
$result = CM_Db_Db::execRead("SELECT `id`, `level`, `ipStart` FROM `cm_model_location_ip`\r\n\t\t\tWHERE `ipEnd` >= ?\r\n\t\t\tORDER BY `ipEnd` ASC\r\n\t\t\tLIMIT 1", array($ip))->fetch();
if ($result) {
if ($result['ipStart'] <= $ip) {
return new CM_Model_Location($result['level'], $result['id']);
}
}
return null;
}
示例2: _getAggregationData
/**
* @return array
*/
protected function _getAggregationData()
{
$cacheKey = $this->_getCacheKeyAggregation();
$cache = CM_Cache_Local::getInstance();
if (false === ($aggregationData = $cache->get($cacheKey))) {
$conversionData = CM_Db_Db::execRead('
SELECT COUNT(1) as `conversionCount`, SUM(`conversionWeight`) as `conversionWeight`, SUM(`conversionWeight` * `conversionWeight`) as `conversionWeightSquared`
FROM `cm_splittestVariation_fixture`
WHERE `splittestId`=? AND `variationId`=? AND `conversionStamp` IS NOT NULL', array($this->_getSplittestId(), $this->getId()))->fetch();
$fixtureCount = (int) CM_Db_Db::execRead('SELECT COUNT(1) FROM `cm_splittestVariation_fixture`
WHERE `splittestId`=? AND `variationId`=?', array($this->_getSplittestId(), $this->getId()))->fetchColumn();
$aggregationData = array('conversionCount' => (int) $conversionData['conversionCount'], 'conversionWeight' => (double) $conversionData['conversionWeight'], 'conversionWeightSquared' => (double) $conversionData['conversionWeightSquared'], 'fixtureCount' => $fixtureCount);
$cache->set($cacheKey, $aggregationData, 30);
}
return $aggregationData;
}
示例3: while
<?php
return;
$rows = CM_Db_Db::execRead('SELECT `id`, `thumbnailCount` FROM cm_streamChannel_media WHERE thumbnailCount > 0');
while ($row = $rows->fetch()) {
CM_Db_Db::exec('UPDATE cm_streamChannel_media SET `data`=? WHERE `id`=? ', [CM_Params::encode(['thumbnailCount' => (int) $row['thumbnailCount']], true), $row['id']]);
}
$rows = CM_Db_Db::execRead('SELECT `id`, `thumbnailCount` FROM cm_streamChannelArchive_media WHERE thumbnailCount > 0');
while ($row = $rows->fetch()) {
CM_Db_Db::exec('UPDATE cm_streamChannelArchive_media SET `data`=? WHERE `id`=? ', [CM_Params::encode(['thumbnailCount' => (int) $row['thumbnailCount']], true), $row['id']]);
}
示例4: processQueue
/**
* @param int $limit
*/
public static function processQueue($limit)
{
$limit = (int) $limit;
$result = CM_Db_Db::execRead('SELECT * FROM `cm_mail` ORDER BY `createStamp` LIMIT ' . $limit);
while ($row = $result->fetch()) {
$mail = new CM_Mail();
foreach (unserialize($row['to']) as $to) {
$mail->addTo($to['address'], $to['name']);
}
foreach (unserialize($row['replyTo']) as $replyTo) {
$mail->addReplyTo($replyTo['address'], $replyTo['name']);
}
foreach (unserialize($row['cc']) as $cc) {
$mail->addCc($cc['address'], $cc['name']);
}
foreach (unserialize($row['bcc']) as $bcc) {
$mail->addBcc($bcc['address'], $bcc['name']);
}
if ($headerList = unserialize($row['customHeaders'])) {
foreach ($headerList as $label => $valueList) {
foreach ($valueList as $value) {
$mail->addCustomHeader($label, $value);
}
}
}
$sender = unserialize($row['sender']);
$mail->setSender($sender['address'], $sender['name']);
$mail->_send($row['subject'], $row['text'], $row['html']);
CM_Db_Db::delete('cm_mail', array('id' => $row['id']));
}
}