本文整理汇总了PHP中QueryBuilder::describe方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::describe方法的具体用法?PHP QueryBuilder::describe怎么用?PHP QueryBuilder::describe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::describe方法的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;
}
示例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;
}