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


PHP SelectQuery::execute方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $cache_key = MemoryObjectStore::gen_key(array($this->build_sql(), $this->build_sql_values()));
     if (!$this->reload) {
         $cache = MemoryObjectStore::get($cache_key);
     }
     if (!empty($cache)) {
         return $cache;
     } else {
         $result = parent::execute();
         if (is_array($result)) {
             foreach ($result as $result_key => $result_val) {
                 foreach ($this->additions as $key => $val) {
                     $result[$result_key]->{$key} = $val;
                 }
             }
         } else {
             foreach ($this->additions as $key => $val) {
                 $result->{$key} = $val;
             }
         }
         MemoryObjectStore::put($cache_key, $result);
     }
     return $result;
 }
开发者ID:dreamblazenet,项目名称:sqls,代码行数:25,代码来源:FindQuery.php

示例2: finishQuery

 /**
  * Finishes the query.
  *
  * Adds tags, metaData, range and returns the requested list or count.
  *
  * @param SelectQuery $select_query
  * A SelectQuery which has entity_type, entity_id, revision_id and bundle
  * fields added.
  * @param $id_key
  * Which field's values to use as the returned array keys.
  *
  * @return
  * See EntityFieldQuery::execute().
  */
 function finishQuery($select_query, $id_key = 'entity_id')
 {
     foreach ($this->tags as $tag) {
         $select_query->addTag($tag);
     }
     foreach ($this->metaData as $key => $object) {
         $select_query->addMetaData($key, $object);
     }
     $select_query->addMetaData('entity_field_query', $this);
     if ($this->range) {
         $select_query->range($this->range['start'], $this->range['length']);
     }
     if ($this->count) {
         return $select_query->countQuery()->execute()->fetchField();
     }
     $return = array();
     foreach ($this->fields as $key => $field) {
         if ('field_sql_storage' == $field['storage']['type']) {
             foreach ($select_query->conditions() as $condition) {
                 if (is_array($condition) && array_key_exists('field', $condition) && strpos($condition['field'], 'field_data_' . $field['field_name'] . $key . '.') === 0) {
                     list($table_alias, $column) = explode('.', $condition['field']);
                     $select_query->addField($table_alias, $column, $field['field_name']);
                     break;
                 }
             }
         }
     }
     $this->orderedResults = array();
     foreach ($select_query->execute() as $partial_entity) {
         $bundle = isset($partial_entity->bundle) ? $partial_entity->bundle : NULL;
         $entity = entity_create_stub_entity($partial_entity->entity_type, array($partial_entity->entity_id, $partial_entity->revision_id, $bundle));
         $return[$partial_entity->entity_type][$partial_entity->{$id_key}] = $entity;
         $this->orderedResults[] = $partial_entity;
     }
     return $return;
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:50,代码来源:ThemeKeyEntityFieldQuery.php

示例3: execute

 /**
  * @return string
  */
 public function execute()
 {
     self::debug(['SQL query is: %s'], [trim(str_replace("\n", ' ', $this->query))]);
     return $this->query->execute()->fetchField();
 }
开发者ID:BR0kEN-,项目名称:TqExtension,代码行数:8,代码来源:FetchField.php

示例4: execute

 public function execute()
 {
     return $this->selectQuery->execute()->fetchObject();
 }
开发者ID:itarato,项目名称:micmod,代码行数:4,代码来源:SelectQueryEngine.php

示例5: exec

 public function exec($q, $p = array())
 {
     $query = new SelectQuery($this, null, $q, $p);
     if ($query->execute()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:peter23,项目名称:fluentpdo,代码行数:9,代码来源:FluentPDO.php


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