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


PHP Zend_Db_Select::order方法代码示例

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


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

示例1: getById

 function getById($jobid)
 {
     // do Bacula ACLs
     Zend_Loader::loadClass('Job');
     $table = new Job();
     if (!$table->isJobIdExists($jobid)) {
         return FALSE;
     }
     $select = new Zend_Db_Select($this->db);
     switch ($this->db_adapter) {
         case 'PDO_SQLITE':
             // bug http://framework.zend.com/issues/browse/ZF-884
             $select->distinct();
             $select->from(array('l' => 'Log'), array('logid' => 'LogId', 'jobid' => 'JobId', 'LogTime' => 'Time', 'logtext' => 'LogText'));
             $select->where("JobId = ?", $jobid);
             $select->order(array('LogId', 'LogTime'));
             break;
         default:
             // mysql, postgresql
             $select->distinct();
             $select->from(array('l' => 'Log'), array('LogId', 'JobId', 'LogTime' => 'Time', 'LogText'));
             $select->where("JobId = ?", $jobid);
             $select->order(array('LogId', 'LogTime'));
     }
     //$sql = $select->__toString(); echo "<pre>$sql</pre>"; exit; // for !!!debug!!!
     $stmt = $select->query();
     return $stmt->fetchAll();
 }
开发者ID:neverstoplwy,项目名称:contrib-webacula,代码行数:28,代码来源:Log.php

示例2: orderBy

 /**
  * sortiert nach Spaltenname der durch den Paginator dargestellten
  * Tabelle
  *
  * @param string $columnName
  */
 public function orderBy($columnName)
 {
     if ($this->isRawcolumn($columnName)) {
         $this->select->order($columnName);
     }
     //ENDE: if()
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:13,代码来源:Extended.php

示例3: _renderOrders

 /**
  * Render sql select orders
  *
  * @return  Varien_Data_Collection_Db
  */
 protected function _renderOrders()
 {
     foreach ($this->_orders as $orderExpr) {
         $this->_select->order($orderExpr);
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:12,代码来源:Db.php

示例4: _renderOrders

 /**
  * Render sql select orders
  *
  * @return  Varien_Data_Collection_Db
  */
 protected function _renderOrders()
 {
     $ordersInSelect = $this->_select->getPart(Zend_Db_Select::ORDER);
     foreach ($this->_orders as $orderExpr) {
         if (!in_array($orderExpr, $ordersInSelect)) {
             $this->_select->order($orderExpr);
         }
     }
     return $this;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:15,代码来源:Db.php

示例5: _renderOrders

 /**
  * Render sql select orders
  *
  * @return  Varien_Data_Collection_Db
  */
 protected function _renderOrders()
 {
     if (!$this->_isOrdersRendered) {
         foreach ($this->_orders as $field => $direction) {
             $this->_select->order(new Zend_Db_Expr($field . ' ' . $direction));
         }
         $this->_isOrdersRendered = true;
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:15,代码来源:Db.php

示例6: _getRelatedCompaniesLinks

 /**
  * @return array $relatedEntries
  */
 private function _getRelatedCompaniesLinks()
 {
     if (!is_null($this->_relatedCache)) {
         return $this->_relatedCache;
     }
     $itemRow = $this->getData()->parent->row;
     $categoryDirectory = $this->_getCategoryDirectory();
     $connectTableName = Kwc_Abstract::getSetting($categoryDirectory->componentClass, 'categoryToItemModelName');
     $linkLimit = $this->_getSetting('linkLimit');
     $categoryReference = Kwc_Directories_Category_Detail_List_Component::getTableReferenceData($connectTableName, 'Category');
     $categoryIds = array();
     $categoryIdsRowset = $itemRow->getRow()->findDependentRowset($connectTableName);
     foreach ($categoryIdsRowset as $categoryIdRow) {
         $categoryIds[] = $categoryIdRow->{$categoryReference['itemColumn']};
     }
     if ($categoryIds) {
         $itemReference = Kwc_Directories_Category_Detail_List_Component::getTableReferenceData($connectTableName, 'Item');
         // anzahl holen
         $s = new Zend_Db_Select(Kwf_Registry::get('db'));
         $s->from($itemReference['tableName'], $itemReference['itemColumn']);
         $s->where($categoryReference['itemColumn'] . ' IN(' . implode(',', $categoryIds) . ')');
         $s->order($itemReference['tableName'] . '.id ASC');
         $rowset = $s->query()->fetchAll();
         // eigene position ermitteln und rauslöschen
         $selfPos = 0;
         $i = 0;
         foreach ($rowset as $k => $row) {
             if ($row[$itemReference['itemColumn']] == $itemRow->id) {
                 if (!$selfPos) {
                     $selfPos = $i;
                 }
                 unset($rowset[$k]);
             }
             $i++;
         }
         $rowset = array_values($rowset);
         $categoryRowCount = count($rowset);
         $itemIds = $ret = array();
         if ($categoryRowCount) {
             for ($i = 0; $i < $linkLimit; $i++) {
                 $offset = ($selfPos + floor($categoryRowCount / $linkLimit) * $i) % $categoryRowCount;
                 $itemIds[] = $rowset[$offset][$itemReference['itemColumn']];
             }
             $itemDirectory = $this->getData()->parent->parent;
             $select = $itemDirectory->getGenerator('detail')->select($itemDirectory);
             $select->where('id IN(' . implode(',', $itemIds) . ')');
             $ret = $itemDirectory->getChildComponents($select);
         }
         $this->_relatedCache = $ret;
         return $ret;
     }
     $this->_relatedCache = array();
     return array();
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:57,代码来源:Component.php

示例7: fetchAllUsers

 public function fetchAllUsers($order = 'id')
 {
     $select = new Zend_Db_Select($this->db);
     $select->from(array('user1' => 'webacula_users'), array('id', 'login', 'name', 'email', 'create_login', 'last_login', 'last_ip', 'active', 'role_id'));
     $select->joinLeft(array('role1' => 'webacula_roles'), 'user1.role_id = role1.id', array('role_name' => 'name', 'role_id' => 'id'));
     if ($order) {
         $select->order(array($order . ' ASC'));
     }
     //$sql = $select->__toString(); var_dump($sql); exit; // for !!!debug!!!
     $stmt = $select->query();
     $result = $stmt->fetchAll();
     return $result;
 }
开发者ID:staser,项目名称:webacula,代码行数:13,代码来源:Wbusers.php

示例8: fetchAllRoles

 public function fetchAllRoles()
 {
     /*
        SELECT roles.id, roles.name, inherits.name AS inherit_name
        FROM webacula_roles AS roles
        LEFT JOIN webacula_roles AS inherits ON inherits.id = roles.inherit_id
        ORDER BY roles.inherit_id, roles.order_role ASC
     */
     $select = new Zend_Db_Select($this->db);
     $select->from(array('roles' => 'webacula_roles'), array('id', 'name', 'description', 'order_role', 'inherit_id'));
     $select->joinLeft(array('inherits' => 'webacula_roles'), 'inherits.id = roles.inherit_id', array('inherit_name' => 'name'));
     $select->order(array('roles.order_role, roles.id ASC'));
     //$sql = $select->__toString(); echo "<pre>$sql</pre>"; exit; // for !!!debug!!!
     $stmt = $select->query();
     return $stmt->fetchAll();
 }
开发者ID:staser,项目名称:webacula,代码行数:16,代码来源:Wbroles.php

示例9: buildQueryOrder

 /**
  * Builds query order
  *
  * @param string $field Field name
  * @param string $order Query Sort Order
  * @param bool   $reset If we should reset the current order
  *
  * @return Bvb_Grid_Source_Zend_Select
  */
 public function buildQueryOrder($field, $order, $reset = false)
 {
     if (!array_key_exists($field, $this->_fields)) {
         return $this;
     }
     foreach ($this->_select->getPart(Zend_Db_Select::COLUMNS) as $col) {
         if ($col[0] . '.' . $col[2] == $field && is_object($col[1])) {
             $field = $col[2];
         }
     }
     if ($reset === true) {
         $this->_select->reset('order');
     }
     $this->_select->order($field . ' ' . $order);
     return $this;
 }
开发者ID:robjacoby,项目名称:xlr8u,代码行数:25,代码来源:Select.php

示例10: search

 public function search($word = null, $limit = null)
 {
     $db = Zend_Registry::get('db');
     $sql = new Zend_Db_Select($db);
     $select = $sql->from('albums');
     if (!is_null($word)) {
         $select = $sql->where($db->quoteInto('title LIKE ? OR artist LIKE ?', "%" . $word . "%"));
     }
     if ($limit > 0) {
         $select = $sql->limit($limit);
     }
     $select = $sql->order('artist DESC');
     $results = $db->query($select);
     $rows = $results->fetchAll();
     return $rows;
 }
开发者ID:rawatanil3,项目名称:Zend-Framework-1.12-Template,代码行数:16,代码来源:Albums.php

示例11: getSelectFilesByJobId

 public function getSelectFilesByJobId($jobid)
 {
     // do Bacula ACLs
     Zend_Loader::loadClass('Job');
     $table = new Job();
     if (!$table->isJobIdExists($jobid)) {
         return FALSE;
     }
     // !!! IMPORTANT !!! с Zend Paginator нельзя использовать DISTINCT иначе не работает в PDO_PGSQL
     $select = new Zend_Db_Select($this->db);
     $select->from(array('f' => 'File'), array('FileId', 'FileIndex', 'LStat'));
     $select->joinLeft(array('p' => 'Path'), 'f.PathId = p.PathId', array('Path'));
     $select->joinLeft(array('n' => 'Filename'), 'f.FileNameId = n.FileNameId', array('Name'));
     $select->where("f.JobId = ?", $jobid);
     $select->order(array('f.FileIndex', 'f.FileId'));
     return $select;
 }
开发者ID:staser,项目名称:webacula,代码行数:17,代码来源:Files.php

示例12: selectByUsersIds

 /**
  * @param number $filterState            
  * @param string $userIds            
  * @throws Zend_Exception
  */
 public function selectByUsersIds($filterState = 1, $ids, $like = NULL)
 {
     try {
         $select = new Zend_Db_Select($this->db);
         $select->from('' . $this->name . '');
         $select->where('state=?', $filterState);
         $select->where('created_user_id IN ( ' . $ids . ' )');
         if (!is_null($like)) {
             $columns = array('cpf', 'dados_cliente');
             $select->where($columns[0] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[1] . ' LIKE ?', '%' . $like . '%');
         }
         $select->order('id DESC');
         return $select;
     } catch (Zend_Exception $e) {
         throw new Zend_Exception($e->getMessage());
         return false;
     }
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:24,代码来源:Clientes.php

示例13: selectQueryList

 /**
  * Retorna uma query com informações do empreendimentos cadastrados
  * 
  * @param number $filter            
  * @throws Zend_Db_Exception
  * @return mixed|boolean
  */
 public function selectQueryList($filter = 1, $like = NULL)
 {
     try {
         $select = new Zend_Db_Select($this->db);
         $select->from($this->name);
         $select->where('state=?', $filter);
         if (!is_null($like)) {
             $columns = array('nome', 'categoria', 'logradouro', 'incorporadora');
             $select->where($columns[0] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[1] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[2] . ' LIKE ?', '%' . $like . '%');
             $select->orWhere($columns[3] . ' LIKE ?', '%' . $like . '%');
         }
         $select->order('id DESC');
         return $select;
     } catch (Zend_Db_Exception $e) {
         throw new Zend_Db_Exception($e->getMessage());
         return false;
     }
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:27,代码来源:Empreendimentos.php

示例14: createSQL

 /**
  * Enter description here ...
  * @param Zend_Db_Select $select
  * @param array $params
  * @return Zend_Db_Select | null
  * @author Tung Ly
  */
 public function createSQL($select, $params)
 {
     $andWhere = array();
     $orWhere = array();
     foreach ($params as $field => $value) {
         if ($field === 'fieldsearch') {
             $andWhere[] = str_replace('{{param}}', addslashes(trim($params['keywords'])), $this->_search[$value]);
         } elseif ($field !== 'keywords' && $value !== 'none') {
             if (isset($this->_search[$field])) {
                 $orWhere[] = str_replace('{{param}}', $params[$field], $this->_search[$field]);
             } elseif (isset($this->_sort[$field])) {
                 $select->order(str_replace('{{param}}', $params[$field], $this->_sort[$field]));
             }
         }
     }
     if (count($andWhere)) {
         $select->where(implode(' AND ', $andWhere));
     }
     if (count($orWhere)) {
         $select->where(implode(' OR ', $orWhere));
     }
     //echo '<pre>'; print_r($params); echo $select;
     return $select;
 }
开发者ID:hocondoimeo,项目名称:giasu-tam.com,代码行数:31,代码来源:Abstract.php

示例15: GetSelectForSort

 /**
  * Get Select object (Zend_Db_Select) for sorting table records
  *
  * @param Zend_Db_Select $select
  * @param string $order         
  *
  * @return Zend_Db_Select
  */
 public static function GetSelectForSort($select, $options)
 {
     $aliasTable = '';
     $order = $options['order'];
     //--------------------------
     $arrOrder = explode('.', $order);
     // Если в параметре сортировки не задан псевдоним таблицы
     // то определим его, и если нужно присоединим,
     // соответствующую таблицу
     if (count($arrOrder) == 1) {
         $joinTableForSort = $options['joinTableForSort'];
         if ($joinTableForSort) {
             // Определим какие таблицы уже присоединены
             $fromTables = $select->getPart(Zend_Db_Select::FROM);
             foreach ($fromTables as $alias => $joinParams) {
                 // Если таблица -> $joinTableForSort уже присоединена
                 // то получим ее псевдоним
                 if ($joinParams['tableName'] == $joinTableForSort) {
                     $aliasTable = $alias;
                 }
             }
             if ($aliasTable) {
                 $order = $aliasTable . '.' . $order;
             } else {
                 // Получим поле сортировки
                 $arrOrder = explode(' ', trim($order));
                 $field = $arrOrder[0];
                 // Присоединим таблицу
                 $joinTable = $joinTableForSort;
                 switch ($joinTable) {
                     case 'blog_posts_profile':
                         $select->joinInner(array('p_profile' => $joinTable), 'p_profile.post_id = p.id', array())->where('p_profile.profile_key = ?', $field);
                         $order = 'p_profile.profile_value ' . $arrOrder[1];
                         break;
                     case 'blog_posts_images':
                         $select->joinInner(array('img' => $joinTable), 'img.post_id = p.id', array());
                         $order = 'img.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'blog_posts_audio':
                         $select->joinInner(array('au' => $joinTable), 'au.post_id = p.id', array());
                         $order = 'au.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'blog_posts_video':
                         $select->joinInner(array('v' => $joinTable), 'v.post_id = p.id', array());
                         $order = 'v.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'blog_posts_lacations':
                         $select->joinInner(array('l' => $joinTable), 'l.post_id = p.id', array());
                         $order = 'l.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'blog_posts_tags':
                         $select->joinInner(array('t' => $joinTable), 't.post_id = p.id', array());
                         $order = 't.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'blog_posts_comments':
                         $select->joinInner(array('c' => $joinTable), 'c.post_id = p.id', array());
                         $order = 'c.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'users':
                         $select->joinInner(array('u' => $joinTable), 'u.id = p.user_id', array());
                         $order = 'u.' . $field . ' ' . $arrOrder[1];
                         break;
                     case 'users_profile':
                         $select->joinInner(array('u_profile' => $joinTable), 'u_profile.user_id = p.user_id', array())->where('u_profile.profile_key = ?', $field);
                         $order = 'u_profile.profile_value ' . $arrOrder[1];
                         break;
                     default:
                         $order = 'p.' . $field . ' ' . $arrOrder[1];
                         break;
                 }
             }
         } else {
             $order = 'p.' . $order;
         }
     }
     $select->order($order);
     return $select;
 }
开发者ID:bsa-git,项目名称:zf-myblog,代码行数:86,代码来源:BlogPost.php


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