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


PHP Am_Query::selectPageRecords方法代码示例

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


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

示例1: deleteProductCategories

 protected function deleteProductCategories($demoId)
 {
     $query = new Am_Query(new ProductCategoryTable());
     $query->add(new Am_Query_Condition_Field('code', 'LIKE', $demoId . ':%'));
     $count = $query->getFoundRows() ? $query->getFoundRows() : 1;
     foreach ($query->selectPageRecords(0, $count) as $pCategory) {
         $pCategory->delete();
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:9,代码来源:AdminBuildDemoController.php

示例2: batchProcess

 public function batchProcess(&$context, Am_BatchProcessor $batch)
 {
     @(list($step, $start) = explode('-', $context));
     $pageCount = 30;
     switch ($step) {
         case 0:
             $q = new Am_Query($this->getTable());
             $count = 0;
             $updated = array();
             foreach ($q->selectPageRecords($start / $pageCount, $pageCount) as $r) {
                 $count++;
                 if (!$this->canUpdate($r)) {
                     continue;
                 }
                 /* @var $r Am_Record */
                 $user = $this->_table->findAmember($r);
                 if (!$user) {
                     // no such records in aMember, disable user record ?
                     $this->_table->disableRecord($r, $this->calculateGroups(null, true));
                 } else {
                     $updated[] = $user->user_id;
                     $this->getTable()->updateFromAmember($r, $user, $this->calculateGroups($user, true));
                     $pass = $this->getDi()->savedPassTable->findSaved($user, $this->getPasswordFormat());
                     if ($pass) {
                         $this->getTable()->updatePassword($r, $pass);
                     }
                 }
             }
             if (!$count) {
                 $step++;
                 $context = "{$step}-0";
             } else {
                 $store = array();
                 foreach ($updated as $v) {
                     $store[] = $v;
                 }
                 $this->getDi()->storeRebuild->setArray($this->_rebuildName, $this->_sessionId, $store, '+3 hour');
                 $start += $count;
                 $context = "{$step}-{$start}";
             }
             break;
         case 1:
             /// now select aMember users not exists in plugin db
             $count = 0;
             $db = $this->getDi()->db;
             $r = $db->queryResultOnly("SELECT t.* from ?_user t left join ?_store_rebuild s on s.user_id = t.user_id and s.rebuild_name = ? and s.session_id = ? \n                    WHERE s.user_id is null LIMIT ?d , ?d", $this->_rebuildName, $this->_sessionId, $start, $pageCount);
             while ($row = $db->fetchRow($r)) {
                 $records[] = $this->getDi()->userTable->createRecord($row);
             }
             foreach ($records as $user) {
                 $count++;
                 /* @var $user User */
                 $this->onSubscriptionChanged(new Am_Event_SubscriptionChanged($user, array(), array()));
             }
             if (!$count) {
                 $context = null;
                 return true;
             }
             $start += $count;
             $context = "{$step}-{$start}";
             break;
         default:
             throw new Am_Exception_InputError(___('Wrong step'));
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:65,代码来源:Databased.php

示例3: batchProcess

 public function batchProcess(&$context, Am_BatchProcessor $batch)
 {
     @(list($step, $start) = explode('-', $context));
     $pageCount = 30;
     switch ($step) {
         case 0:
             $q = new Am_Query($this->getTable());
             $count = 0;
             $updated = array();
             foreach ($q->selectPageRecords($start / $pageCount, $pageCount) as $r) {
                 $count++;
                 if (!$this->canUpdate($r)) {
                     continue;
                 }
                 /* @var $r Am_Record */
                 $user = $this->_table->findAmember($r);
                 if (!$user) {
                     // no such records in aMember, disable user record ?
                     $this->_table->disableRecord($r, $this->calculateGroups(null, true));
                 } else {
                     $updated[] = $user->user_id;
                     $this->getTable()->updateFromAmember($r, $user, $this->calculateGroups($user));
                     $pass = $this->getDi()->savedPassTable->findSaved($user, $this->getPasswordFormat());
                     if ($pass) {
                         $this->getTable()->updatePassword($r, $pass);
                     }
                 }
             }
             if (!$count) {
                 $step++;
                 $context = "{$step}-0";
             } else {
                 $this->getDi()->store->appendBlob($this->_batchStoreId, implode(",", $updated) . ",");
                 $start += $count;
                 $context = "{$step}-{$start}";
             }
             break;
         case 1:
             /// now select aMember users not exists in plugin db
             $q = new Am_Query(new UserTable());
             $q->addWhere("(select not find_in_set(t.user_id, s.`blob_value`) \n                              from ?_store s \n                              where s.name=?)", $this->_batchStoreId);
             $count = 0;
             $records = $q->selectPageRecords($start / $pageCount, $pageCount);
             foreach ($records as $user) {
                 $count++;
                 /* @var $user User */
                 $this->onSubscriptionChanged(new Am_Event_SubscriptionChanged($user, array(), array()));
             }
             if (!$count) {
                 $context = null;
                 return true;
             }
             $start += $count;
             $context = "{$step}-{$start}";
             break;
         default:
             throw new Am_Exception_InputError("Wrong step");
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:59,代码来源:Databased.php


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