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


PHP QueryBuilder::query方法代码示例

本文整理汇总了PHP中QueryBuilder::query方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::query方法的具体用法?PHP QueryBuilder::query怎么用?PHP QueryBuilder::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder::query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Retrieves a listing of texts
  *
  * @param int $page ["param","page"]
  * @param string $fields ["param","fields"]
  * @param array $parameters ["param"]
  * @return array
  *
  * @Access(callback='user_access', args={'access content'}, appendArgs=false)
  */
 public static function index($page = 0, $fields = array(), $parameters = array())
 {
     $builder = new QueryBuilder();
     if ($params['__action'] == 'describe') {
         return $builder->describe();
     }
     if (is_string($fields)) {
         $fields = preg_split('/,\\s?/', $fields);
     }
     $parameters['status'] = 1;
     $parameters['type'] = 'docuwalk_text';
     list($sql, $params) = $builder->query($fields, $parameters);
     $res = db_query_range($sql, $params, $page * 20, 20);
     $nodes = array();
     while ($node = db_fetch_object($res)) {
         $node->uri = services_resource_uri(array('docuwalk-text', $node->nid));
         $nodes[] = $node;
     }
     return $nodes;
 }
开发者ID:hugowetterberg,项目名称:docuwalk,代码行数:30,代码来源:DocuWalkTextResource.php

示例2: index

 /**
  * Retrieves a listing of content items
  *
  * @param int $page ["param","page"]
  * @param string $fields ["param","fields"]
  * @param array $parameters ["param"]
  * @return array
  *
  * @Access(callback='user_access', args={'access content'}, appendArgs=false)
  * @Model(class='ResourceFeedModel', implementation='ConglomerateContentFeedModel', arguments={mode = 'raw', item_length='fulltext'}, allow_overrides={'mode', 'item_length'})
  */
 public static function index($page = 0, $fields = array(), $parameters = array())
 {
     $builder = new QueryBuilder();
     $builder->add_table('p', 'LEFT OUTER JOIN {content_field_image_url} AS p ON p.nid=n.nid', 'n', array('image' => array('column' => 'field_image_url_url')));
     if ($parameters['__action'] == 'describe') {
         return $builder->describe();
     }
     if (empty($fields)) {
         $fields = array('nid', 'type', 'title', 'teaser', 'language');
     } else {
         if (is_string($fields)) {
             $fields = preg_split('/,\\s?/', $fields);
         }
         $fields = array_fill_keys($fields, TRUE);
         $fields['nid'] = TRUE;
         $fields['type'] = TRUE;
         $fields = array_keys($fields);
     }
     // Always enforce the node status condition
     $parameters['status'] = 1;
     // Generate and execute the sql
     list($sql, $params) = $builder->query($fields, $parameters);
     $res = db_query_range($sql, $params, $page * 20, 20);
     $nodes = array();
     while ($node = db_fetch_object($res)) {
         $node->url = url('node/' . $node->nid, array('absolute' => TRUE));
         $node->uri = services_resource_uri(array($node->type, $node->nid));
         $nodes[] = $node;
     }
     return $nodes;
 }
开发者ID:hugowetterberg,项目名称:conglomerate,代码行数:42,代码来源:ConglomerateContentResource.php


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