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


PHP SelectQuery::addWhereNull方法代码示例

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


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

示例1: runUpdate

 /**
  * Run the update
  * 
  * @return boolean
  * @access public
  * @since 6/12/08
  */
 function runUpdate()
 {
     set_time_limit(600);
     $hierarchyMgr = Services::getService("HierarchyManager");
     $idMgr = Services::getService("IdManager");
     $hierarchyId = $idMgr->getId("edu.middlebury.authorization.hierarchy");
     $hierarchy = $hierarchyMgr->getHierarchy($hierarchyId);
     $view = $idMgr->getId("edu.middlebury.authorization.view");
     $authZ = Services::getService("AuthZ");
     $query = new SelectQuery();
     $query->addColumn('az2_explicit_az.id', 'explicit_az_id');
     $query->addTable('az2_explicit_az');
     $query->addTable('az2_j_node_node', INNER_JOIN, 'az2_j_node_node.fk_child = az2_explicit_az.fk_qualifier');
     $query->addTable('az2_implicit_az', LEFT_JOIN, '(az2_implicit_az.fk_explicit_az = az2_explicit_az.id AND az2_j_node_node.fk_parent = az2_implicit_az.fk_qualifier)');
     $query->addWhereEqual('az2_explicit_az.fk_function', 'edu.middlebury.authorization.view');
     $query->addWhereNull('az2_implicit_az.fk_explicit_az');
     $dbc = Services::getService('DatabaseManager');
     $result = $dbc->query($query, IMPORTER_CONNECTION);
     $status = new StatusStars(str_replace('%1', $result->getNumberOfRows(), _("Rebuilding cascading-up implicit 'view' AZs on %1 nodes.")));
     $status->initializeStatistics($result->getNumberOfRows());
     $azCache = $authZ->getAuthorizationCache();
     while ($result->hasNext()) {
         $row = $result->next();
         $azCache->createImplicitAZsUpForAZ($azCache->getExplicitAZById($row['explicit_az_id']));
         $status->updateStatistics();
     }
     return true;
 }
开发者ID:adamfranco,项目名称:segue,代码行数:35,代码来源:Update014_RebuildImplicitAZs.act.php

示例2: execute

 /**
  * Execute
  * 
  * @return void
  * @access public
  * @since 3/26/08
  */
 public function execute()
 {
     if (!$this->isAuthorizedToExecute()) {
         throw new PermissionDeniedException('This command can only be run by admins or from the command-line.');
     }
     header("Content-Type: text/plain");
     if (RequestContext::value('help') || RequestContext::value('h') || RequestContext::value('?')) {
         throw new HelpRequestedException($this->usage);
     }
     $outDir = RequestContext::value('d');
     if (empty($outDir)) {
         throw new InvalidArgumentException("An output directory must be specified.\n\n" . $this->usage);
     }
     if (!is_dir($outDir) || !is_writable($outDir)) {
         throw new InvalidArgumentException("The output directory doesn't exist or is not writeable.\n\n" . $this->usage);
     }
     foreach (SlotAbstract::getLocationCategories() as $category) {
         $baseUrl = SiteDispatcher::getBaseUrlForLocationCategory($category);
         if (!preg_match('/^https?:\\/\\/.+/', $baseUrl)) {
             throw new ConfigurationErrorException('Please set a base URL for the \'' . $category . '\' category with SiteDispatcher::setBaseUrlForLocationCategory($category, $url); in config/slots.conf.php');
         }
     }
     while (ob_get_level()) {
         ob_end_flush();
     }
     flush();
     /*********************************************************
      * Check for a running export
      *********************************************************/
     $dbc = Services::getService('DatabaseManager');
     $query = new SelectQuery();
     $query->addColumn('slot');
     $query->addColumn('pid');
     $query->addTable('site_export_queue');
     $query->addWhereNotEqual('pid', 0);
     $result = $dbc->query($query);
     // If we are exporting, check the status of the export process
     if ($result->hasMoreRows()) {
         // Don't start a new export if one is running.
         if ($this->isRunning($result->field('pid'))) {
             print "An export is already running\n";
             exit;
         } else {
             $query = new UpdateQuery();
             $query->setTable('site_export_queue');
             $query->addValue('status', 'DIED');
             $query->addRawValue('pid', 'NULL');
             $query->addValue('info', 'Process ' . $result->field('pid') . ' has died.');
             $query->addWhereEqual('slot', $result->field('slot'));
             $query->addWhereEqual('pid', $result->field('pid'));
             $dbc->query($query);
         }
     }
     /*********************************************************
      * If there aren't any other exports happening, run our export
      *********************************************************/
     // Find the next slot to update
     $query = new SelectQuery();
     $query->addColumn('slot');
     $query->addTable('site_export_queue', NO_JOIN, '', 'q');
     $query->addTable('segue_slot', INNER_JOIN, 'q.slot = s.shortname', 's');
     $query->addWhereNull('pid');
     $query->addWhereNull('status');
     $query->addWhereNull('alias_target');
     $query->addWhereNotEqual('site_id', '');
     $query->addOrderBy('priority', DESCENDING);
     $query->addOrderBy('slot', ASCENDING);
     $result = $dbc->query($query);
     // Exit if there is nothing to do.
     if (!$result->hasMoreRows()) {
         print "The queue is empty\n";
         exit;
     }
     $slot = $result->field('slot');
     $slotMgr = SlotManager::instance();
     $slotObj = $slotMgr->getSlotByShortname($slot);
     $baseUrl = SiteDispatcher::getBaseUrlForLocationCategory($slotObj->getLocationCategory());
     // Mark that we are running
     $query = new UpdateQuery();
     $query->setTable('site_export_queue');
     $query->addValue('pid', strval(getmypid()));
     $query->addWhereEqual('slot', $slot);
     $dbc->query($query);
     // Run the export
     $start = microtime(true);
     try {
         $exportDirname = $slot . "-html";
         $exportDir = $outDir . "/" . $exportDirname;
         $archivePath = $outDir . '/' . $exportDirname . ".zip";
         if (file_exists($exportDir)) {
             $this->deleteRecursive($exportDir);
         }
         mkdir($exportDir);
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:segue,代码行数:101,代码来源:check_export_queue.act.php


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