本文整理汇总了PHP中POD::queryAllWithDBCache方法的典型用法代码示例。如果您正苦于以下问题:PHP POD::queryAllWithDBCache方法的具体用法?PHP POD::queryAllWithDBCache怎么用?PHP POD::queryAllWithDBCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POD
的用法示例。
在下文中一共展示了POD::queryAllWithDBCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCalendar
function getCalendar($blogid, $period)
{
global $database;
$calendar = array('days' => array());
if ($period === true || !checkPeriod($period)) {
$period = Timestamp::getYearMonth();
}
$calendar['period'] = $period;
$calendar['year'] = substr($period, 0, 4);
$calendar['month'] = substr($period, 4, 2);
$visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid);
switch (POD::dbms()) {
case 'Cubrid':
$result = POD::queryAllWithDBCache("SELECT DISTINCT TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'DD')\n\t\t\t\tFROM {$database['prefix']}Entries e\n\t\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND\n\t\t\t\t\tTO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'YYYY') = '{$calendar['year']}' AND\n\t\t\t\t\tTO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'MM') = '{$calendar['month']}'", 'entry');
break;
case 'MySQL':
case 'MySQLi':
case 'PostgreSQL':
default:
$result = POD::queryAllWithDBCache("SELECT DISTINCT DAYOFMONTH(FROM_UNIXTIME(e.published)) \n\t\t\t\tFROM {$database['prefix']}Entries e\n\t\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND YEAR(FROM_UNIXTIME(e.published)) = {$calendar['year']} AND MONTH(FROM_UNIXTIME(e.published)) = {$calendar['month']}", 'entry');
break;
}
if ($result) {
foreach ($result as $dayArray) {
list($day) = $dayArray;
array_push($calendar['days'], $day);
}
}
$calendar['days'] = array_flip($calendar['days']);
return $calendar;
}
示例2: getRecentRemoteResponses
function getRecentRemoteResponses($blogid, $count = false, $guestShip = false, $type = null)
{
global $database, $skinSetting;
if (!is_null($type)) {
$typeFilter = " AND t.responsetype = '" . POD::escapeString($type) . "'";
} else {
$typeFilter = '';
}
$sql = doesHaveOwnership() && !$guestShip ? "SELECT t.*, e.slogan \n\t\tFROM \n\t\t\t{$database['prefix']}RemoteResponses t\n\t\t\tLEFT JOIN {$database['prefix']}Entries e ON t.blogid = e.blogid AND t.entry = e.id AND e.draft = 0\n\t\tWHERE \n\t\t\tt.blogid = {$blogid} AND t.isfiltered = 0 {$typeFilter} \n\t\tORDER BY \n\t\t\tt.written \n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['trackbacksOnRecent']) : "SELECT t.*, e.slogan \n\t\tFROM \n\t\t\t{$database['prefix']}RemoteResponses t \n\t\t\tLEFT JOIN {$database['prefix']}Entries e ON t.blogid = e.blogid AND t.entry = e.id\n\t\tWHERE \n\t\t\tt.blogid = {$blogid} \n\t\t\tAND t.isfiltered = 0 \n\t\t\tAND e.draft = 0 \n\t\t\tAND e.visibility >= 2 " . getPrivateCategoryExclusionQuery($blogid) . "\n\t\t\t{$typeFilter}\n\t\tORDER BY \n\t\t\tt.written \n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['trackbacksOnRecent']);
if ($result = POD::queryAllWithDBCache($sql, 'remoteResponse')) {
return $result;
} else {
return array();
}
}
示例3: getRecentComments
function getRecentComments($blogid, $count = false, $isGuestbook = false, $guestShip = false)
{
global $skinSetting, $database;
$comments = array();
if (!$isGuestbook && !Acl::check("group.editors")) {
$userLimit = ' AND e.userid = ' . getUserId();
} else {
$userLimit = '';
}
$sql = doesHaveOwnership() && !$guestShip ? "SELECT r.*, e.title, e.slogan\n\t\tFROM\n\t\t\t{$database['prefix']}Comments r\n\t\t\tINNER JOIN {$database['prefix']}Entries e ON r.blogid = e.blogid AND r.entry = e.id AND e.draft = 0{$userLimit}\n\t\tWHERE\n\t\t\tr.blogid = {$blogid}" . ($isGuestbook != false ? " AND r.entry=0" : " AND r.entry>0") . " AND r.isfiltered = 0\n\t\tORDER BY\n\t\t\tr.written\n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['commentsOnRecent']) : "SELECT r.*, e.title, e.slogan\n\t\tFROM\n\t\t\t{$database['prefix']}Comments r\n\t\t\tINNER JOIN {$database['prefix']}Entries e ON r.blogid = e.blogid AND r.entry = e.id AND e.draft = 0\n\t\t\tLEFT OUTER JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id\n\t\tWHERE\n\t\t\tr.blogid = {$blogid} AND e.draft = 0 AND e.visibility >= 2" . getPrivateCategoryExclusionQuery($blogid) . ($isGuestbook != false ? " AND r.entry = 0" : " AND r.entry > 0") . " AND r.isfiltered = 0\n\t\tORDER BY\n\t\t\tr.written\n\t\tDESC LIMIT " . ($count != false ? $count : $skinSetting['commentsOnRecent']);
if ($result = POD::queryAllWithDBCache($sql, 'comment')) {
foreach ($result as $comment) {
if ($comment['secret'] == 1 && !doesHaveOwnership()) {
if (!doesHaveOpenIDPriv($comment)) {
$comment['name'] = _text('비밀방문자');
$comment['homepage'] = '';
$comment['comment'] = _text('관리자만 볼 수 있는 댓글입니다.');
}
}
array_push($comments, $comment);
}
}
return $comments;
}
示例4: printIphoneArchives
function printIphoneArchives($blogid)
{
global $database;
$archives = array();
$visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid);
$skinSetting = Setting::getSkinSettings($blogid);
$result = POD::queryAllWithDBCache("SELECT EXTRACT(year_month FROM FROM_UNIXTIME(e.published)) period, COUNT(*) count \n\t\tFROM {$database['prefix']}Entries e\n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 \n\t\tGROUP BY period \n\t\tORDER BY period \n\t\tDESC ");
if ($result) {
foreach ($result as $archive) {
array_push($archives, $archive);
}
}
return $archives;
}
示例5: getAll
public function getAll($field = '*', $options = null)
{
$field = $this->_treatReservedFields($field);
$options = $this->_treatOptions($options);
if ($options['usedbcache'] == true) {
$result = POD::queryAllWithDBCache('SELECT ' . $options['filter'] . $field . ' FROM ' . $this->_getTableName() . $this->_extendClause() . $this->_makeWhereClause(), $options['cacheprefix']);
} else {
$result = POD::queryAll('SELECT ' . $options['filter'] . $field . ' FROM ' . $this->_getTableName() . $this->_extendClause() . $this->_makeWhereClause());
}
$this->_manage_pool_stack();
return $result;
}