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


PHP SelectQuery::copy方法代码示例

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


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

示例1: updateTable

 /**
  * Update a record table for a set of harvesters and repositories
  * 
  * @param string $table
  * @param array $allowedRepositoryIdStrings
  * @param array $authGroupIdStrings	The ids of the groups to check view authorization for,
  *	May be one of the following or another group Id string:
  *		edu.middlebury.agents.everyone
  *		edu.middlebury.agents.all_agents
  *	If empty, all assets in the specified repositories will be added regardless of
  *	their visibility.
  *
  * @return void
  * @access public
  * @since 3/9/07
  */
 function updateTable($table, $allowedRepositoryIdStrings, $authGroupIdStrings)
 {
     ArgumentValidator::validate($table, StringValidatorRule::getRule());
     ArgumentValidator::validate($allowedRepositoryIdStrings, ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule()));
     ArgumentValidator::validate($authGroupIdStrings, ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule()));
     $harmoni = Harmoni::instance();
     $config = $harmoni->getAttachedData('OAI_CONFIG');
     $repositoryManager = Services::getService('Repository');
     $authorizationManager = Services::getService('AuthZ');
     $idManager = Services::getService("IdManager");
     $dbc = Services::getService("DatabaseManager");
     $authGroupIds = array();
     foreach ($authGroupIdStrings as $id) {
         $authGroupIds[] = $idManager->getId($id);
     }
     $baseCheckQuery = new SelectQuery();
     $baseCheckQuery->addTable('oai_' . $table);
     $baseCheckQuery->addColumn('datestamp');
     $baseCheckQuery->addColumn('deleted');
     $baseUpdateQuery = new UpdateQuery();
     $baseUpdateQuery->setTable('oai_' . $table);
     $baseUpdateColumns = array('datestamp', 'deleted', 'oai_set', 'dc_title', 'dc_description');
     $dcUpdateColumns = array('datestamp', 'deleted', 'oai_set', 'dc_title', 'dc_description', 'dc_creator', 'dc_subject', 'dc_contributor', 'dc_publisher', 'dc_date', 'dc_type', 'dc_format', 'dc_identifier', 'dc_source', 'dc_language', 'dc_relation', 'dc_coverage', 'dc_rights');
     $baseInsertQuery = new InsertQuery();
     $baseInsertQuery->setTable('oai_' . $table);
     $baseInsertColumns = array('datestamp', 'oai_identifier', 'deleted', 'oai_set', 'dc_title', 'dc_description');
     $dcInsertColumns = array('datestamp', 'oai_identifier', 'deleted', 'oai_set', 'dc_title', 'dc_description', 'dc_creator', 'dc_subject', 'dc_contributor', 'dc_publisher', 'dc_date', 'dc_type', 'dc_format', 'dc_identifier', 'dc_source', 'dc_language', 'dc_relation', 'dc_coverage', 'dc_rights');
     $baseDeleteQuery = new UpdateQuery();
     $baseDeleteQuery->setTable('oai_' . $table);
     $baseDeleteQuery->addValue('deleted', 'true');
     $baseDeleteQuery->addRawValue('datestamp', 'NOW()');
     $baseUndeleteQuery = new UpdateQuery();
     $baseUndeleteQuery->setTable('oai_' . $table);
     $baseUndeleteQuery->addValue('deleted', 'false');
     $baseUndeleteQuery->addRawValue('datestamp', 'NOW()');
     $forceUpdate = false;
     $repositories = $repositoryManager->getRepositories();
     $r = 0;
     if (count($allowedRepositoryIdStrings)) {
         $numR = count($allowedRepositoryIdStrings);
     } else {
         $numR = $repositories->count();
     }
     $numUpdates = 0;
     $numDeleted = 0;
     $message = _('Updating OAI records for repository (%1 of %2) : ');
     $message = str_replace('%2', $numR, $message);
     $instituteId = $idManager->getId('edu.middlebury.agents.users');
     $viewId = $idManager->getId('edu.middlebury.authorization.view');
     require_once HARMONI . "/utilities/Timer.class.php";
     $timer = new Timer();
     $timer->start();
     $existingRepositoryIds = array();
     while ($repositories->hasNext()) {
         $updatesInRepository = 0;
         $repository = $repositories->next();
         $repositoryId = $repository->getId();
         // Only work with allowed repositories
         if (count($allowedRepositoryIdStrings) && !in_array($repositoryId->getIdString(), $allowedRepositoryIdStrings)) {
             continue;
         }
         $r++;
         $existingRepositoryIds[] = $repositoryId->getIdString();
         $assets = $repository->getAssets();
         $status = new CLIStatusStars(str_replace('%1', $r, $message) . $repository->getDisplayName());
         $status->initializeStatistics($assets->count());
         $existingAssetIds = array();
         while ($assets->hasNext()) {
             $asset = $assets->next();
             $assetId = $asset->getId();
             $existingAssetIds[] = $assetId->getIdString();
             try {
                 $modificationDate = $asset->getModificationDate();
             } catch (UnimplementedException $e) {
                 $modificationDate = DateAndTime::now();
             }
             $query = $baseCheckQuery->copy();
             $query->addWhereEqual("oai_set", $repositoryId->getIdString());
             $query->addWhereEqual("oai_identifier", $assetId->getIdString());
             $result = $dbc->query($query, $config->getProperty('OAI_DBID'));
             if (!$result->getNumberOfRows()) {
                 // 					printpre("Doesn't exist:\t".$asset->getDisplayName()."");
                 $query = $baseInsertQuery->copy();
                 $query->addValue('oai_set', $repositoryId->getIdString());
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:concerto,代码行数:101,代码来源:update.act.php


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