当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiBase::groupConcatTest方法代码示例

本文整理汇总了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);
 }
开发者ID:Abbe98,项目名称:ODOK,代码行数:31,代码来源:ApiArtist.php


注:本文中的ApiBase::groupConcatTest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。