當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。