本文整理汇总了PHP中ApiBase::groupConcatTest方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiBase::groupConcatTest方法的具体用法?PHP ApiBase::groupConcatTest怎么用?PHP ApiBase::groupConcatTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiBase
的用法示例。
在下文中一共展示了ApiBase::groupConcatTest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWorks
private function getWorks($artist, $warning)
{
# set group_concat_max_len explicitly so that we are always testing agains the same limit
ApiBase::doQuery('SET SESSION group_concat_max_len = ' . ApiBase::group_concat_max_len);
$query = '
SELECT al.`artist` as artist, GROUP_CONCAT(al.`object` SEPARATOR "|") AS objects
FROM `artist_links` al
INNER JOIN `artist_table` at ON at.`id` = al.`artist`
WHERE at.`id` in (
"' . implode('", "', array_map('mysql_real_escape_string', $artist)) . '"
)
GROUP BY artist;';
#do query
try {
$response = ApiBase::doQuery($query);
} catch (Exception $e) {
return ApiBase::makeErrorResult('610', 'Select Failed. ' . 'Probably wrong name supplied.[' . $e->getMessage() . ']', $warning);
}
#check that results were not truncated, since this is a silent fail
try {
ApiBase::groupConcatTest($response, 'objects', 'works');
} catch (CharacterLimitException $e) {
$w = $e->getMessage();
}
# put together new array of works
$works = array();
foreach ($response as $r) {
$works[$r['artist']] = explode('|', $r['objects']);
}
return array($works, $w);
}