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


PHP Zend_Db_Adapter_Pdo_Mysql::select方法代码示例

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


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

示例1: getNoteTypes

 /**
  * get all note types
  *
  * @param boolean|optional $onlyNonSystemNotes
  * @return Tinebase_Record_RecordSet of Tinebase_Model_NoteType
  */
 public function getNoteTypes($onlyNonSystemNotes = false, $onlyIds = false)
 {
     $select = $this->_db->select()->from(array('note_types' => SQL_TABLE_PREFIX . 'note_types'), $onlyIds ? 'id' : '*');
     if ($onlyNonSystemNotes) {
         $select->where($this->_db->quoteIdentifier('is_user_type') . ' = 1');
     }
     $stmt = $this->_db->query($select);
     if ($onlyIds) {
         $types = $stmt->fetchAll(Zend_Db::FETCH_COLUMN);
     } else {
         $rows = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
         $types = new Tinebase_Record_RecordSet('Tinebase_Model_NoteType', $rows, true);
     }
     return $types;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:21,代码来源:Notes.php

示例2: mergeDuplicateSharedTags

 /**
  * merge duplicate shared tags
  * 
  * @param string $model record model for which tags should be merged
  * @param boolean $deleteObsoleteTags
  * @param boolean $ignoreAcl
  * 
  * @see 0007354: function for merging duplicate tags
  */
 public function mergeDuplicateSharedTags($model, $deleteObsoleteTags = TRUE, $ignoreAcl = FALSE)
 {
     $select = $this->_db->select()->from(array('tags' => SQL_TABLE_PREFIX . 'tags'), 'name')->where($this->_db->quoteIdentifier('type') . ' = ?', Tinebase_Model_Tag::TYPE_SHARED)->where($this->_db->quoteIdentifier('is_deleted') . ' = 0')->group('name')->having('COUNT(' . $this->_db->quoteIdentifier('name') . ') > 1');
     $queryResult = $this->_db->fetchAll($select);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Found ' . count($queryResult) . ' duplicate tag names.');
     }
     $controller = Tinebase_Core::getApplicationInstance($model);
     if ($ignoreAcl) {
         $containerChecks = $controller->doContainerACLChecks(FALSE);
     }
     $recordFilterModel = $model . 'Filter';
     foreach ($queryResult as $duplicateTag) {
         $filter = new Tinebase_Model_TagFilter(array('name' => $duplicateTag['name'], 'type' => Tinebase_Model_Tag::TYPE_SHARED));
         $paging = new Tinebase_Model_Pagination(array('sort' => 'creation_time'));
         $tagsWithSameName = $this->searchTags($filter, $paging);
         $targetTag = $tagsWithSameName->getFirstRecord();
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Merging tag ' . $duplicateTag['name'] . '. Found ' . count($tagsWithSameName) . ' tags with this name.');
         }
         foreach ($tagsWithSameName as $tag) {
             if ($tag->getId() === $targetTag->getId()) {
                 // skip target (oldest) tag
                 continue;
             }
             $recordFilter = new $recordFilterModel(array(array('field' => 'tag', 'operator' => 'in', 'value' => array($tag->getId()))));
             $recordIdsWithTagToMerge = $controller->search($recordFilter, NULL, FALSE, TRUE);
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Found ' . count($recordIdsWithTagToMerge) . ' ' . $model . '(s) with tags to be merged.');
             }
             if (!empty($recordIdsWithTagToMerge)) {
                 $recordFilter = new $recordFilterModel(array(array('field' => 'id', 'operator' => 'in', 'value' => $recordIdsWithTagToMerge)));
                 $this->attachTagToMultipleRecords($recordFilter, $targetTag);
                 $this->detachTagsFromMultipleRecords($recordFilter, $tag->getId());
             }
             // check occurrence of the merged tag and remove it if obsolete
             $tag = $this->get($tag);
             if ($deleteObsoleteTags && $tag->occurrence == 0) {
                 $this->deleteTags($tag->getId(), $ignoreAcl);
             }
         }
     }
     if ($ignoreAcl) {
         /** @noinspection PhpUndefinedVariableInspection */
         $controller->doContainerACLChecks($containerChecks);
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:56,代码来源:Tags.php

示例3: getApplicationRights

 /**
  * returns rights for given application and accountId
  *
  * @param   string $_application the name of the application
  * @param   int $_accountId the numeric account id
  * @return  array list of rights
  * @throws  Tinebase_Exception_AccessDenied
  * 
  * @todo    add right group by to statement if possible or remove duplicates in result array
  */
 public function getApplicationRights($_application, $_accountId)
 {
     $application = Tinebase_Application::getInstance()->getApplicationByName($_application);
     if ($application->status != 'enabled') {
         throw new Tinebase_Exception_AccessDenied('User has no rights. the application is disabled.');
     }
     $roleMemberships = $this->getRoleMemberships($_accountId);
     $select = $this->_db->select()->from(SQL_TABLE_PREFIX . 'role_rights', array('account_rights' => Tinebase_Backend_Sql_Command::getAggregateFunction($this->_db, $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . 'role_rights.right'))))->where($this->_db->quoteInto($this->_db->quoteIdentifier(SQL_TABLE_PREFIX . 'role_rights.application_id') . ' = ?', $application->getId()))->where($this->_db->quoteInto($this->_db->quoteIdentifier('role_id') . ' IN (?)', $roleMemberships))->group(SQL_TABLE_PREFIX . 'role_rights.application_id');
     $stmt = $this->_db->query($select);
     $row = $stmt->fetch(Zend_Db::FETCH_ASSOC);
     if ($row === false) {
         return array();
     }
     $rights = explode(',', $row['account_rights']);
     // remove duplicates
     $result = array();
     foreach ($rights as $right) {
         if (!in_array($right, $result)) {
             $result[] = $right;
         }
     }
     return $result;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:33,代码来源:Roles.php


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