本文整理汇总了PHP中Sql::pSelectMapped方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::pSelectMapped方法的具体用法?PHP Sql::pSelectMapped怎么用?PHP Sql::pSelectMapped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::pSelectMapped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$collations = Sql::pSelectMapped('SHOW VARIABLES LIKE "%collation%"');
foreach ($collations as $ch_name => $val) {
echo $ch_name . ' = ' . $val . '<br/>';
}
echo '<br/>';
// show MySQL query cache settings
$data = Sql::pSelectMapped('SHOW VARIABLES LIKE "%query_cache%"');
if ($data['have_query_cache'] == 'YES') {
echo '<h2>Query cache settings</h2>';
echo 'Type: ' . $data['query_cache_type'] . '<br/>';
//valid values: ON, OFF or DEMAND
echo 'Size: ' . formatDataSize($data['query_cache_size']) . ' (total size)<br/>';
echo 'Limit: ' . formatDataSize($data['query_cache_limit']) . ' (per query)<br/>';
echo 'Min result unit: ' . formatDataSize($data['query_cache_min_res_unit']) . '<br/>';
echo 'Wlock invalidate: ' . $data['query_cache_wlock_invalidate'] . '<br/><br/>';
// current query cache status
$data = Sql::pSelectMapped('SHOW STATUS LIKE "%Qcache%"');
echo '<h2>Query cache status</h2>';
echo 'Hits: ' . formatNumber($data['Qcache_hits']) . '<br/>';
echo 'Inserts: ' . formatNumber($data['Qcache_inserts']) . '<br/>';
echo 'Queries in cache: ' . formatNumber($data['Qcache_queries_in_cache']) . '<br/>';
echo 'Total blocks: ' . formatNumber($data['Qcache_total_blocks']) . '<br/>';
echo '<br/>';
echo 'Not cached: ' . formatNumber($data['Qcache_not_cached']) . '<br/>';
echo 'Free memory: ' . formatDataSize($data['Qcache_free_memory']) . '<br/>';
echo '<br/>';
echo 'Free blocks: ' . formatNumber($data['Qcache_free_blocks']) . '<br/>';
echo 'Lowmem prunes: ' . formatNumber($data['Qcache_lowmem_prunes']);
} else {
echo '<h2>MySQL query cache is disabled</h2>';
}
示例2: getStats
/** Get statistics for specified poll */
static function getStats($type, $id)
{
$q = 'SELECT t1.categoryName, ' . '(SELECT COUNT(*) FROM ' . self::$tbl_name . ' WHERE type = ? AND value = t1.categoryId) AS cnt' . ' FROM tblCategories AS t1' . ' WHERE t1.ownerId = ?';
return Sql::pSelectMapped($q, 'ii', $type, $id);
}