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


PHP R::exec方法代码示例

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


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

示例1: updateUserData

 /**
  * シングル・サインオンの結果を元にDBのユーザ情報を更新する。
  *
  * @param array $userInfo
  */
 public static function updateUserData($userInfo)
 {
     // userInfoは以下のデータを含む
     //
     // [
     //     sub         => iit0001,
     //     updated_at  => 1424903837,
     //     email       => tekezo@iit.jp,
     //     name        => iit0001,
     //     family_name => Takayama,
     //     given_name  => Fumihiko,
     // ]
     if (!isset($userInfo['sub'])) {
         return;
     }
     $user_id = $userInfo['sub'];
     $updates = array();
     $params = array(':user_id' => $user_id);
     if (isset($userInfo['email'])) {
         $updates[] = 'email = :email';
         $params[':email'] = $userInfo['email'];
     }
     $user_name = (isset($userInfo['family_name']) ? $userInfo['family_name'] : '') . ' ' . (isset($userInfo['given_name']) ? $userInfo['given_name'] : '');
     $user_name = trim($user_name);
     if ($user_name) {
         $updates[] = 'user_name = :user_name';
         $params[':user_name'] = $user_name;
     }
     if (!empty($updates)) {
         $sql = 'UPDATE user SET ' . join(',', $updates) . ' WHERE user_id = :user_id';
         \R::exec($sql, $params);
     }
 }
开发者ID:Yusuke-KOMIYAMA,项目名称:sop,代码行数:38,代码来源:SingleSignOn.php

示例2: testRun

 public function testRun()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     //Create 2 sent notifications, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage->folder = $folder;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $emailMessage->getClassId('Item');
     R::exec($sql);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message 2', $super);
     $emailMessage2->folder = $folder;
     $saved = $emailMessage2->save();
     $this->assertTrue($saved);
     $this->assertEquals(2, count(EmailMessage::getAll()));
     $job = new ClearSentNotificationsEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(1, count($emailMessages));
     $this->assertEquals($emailMessage2->id, $emailMessages[0]->id);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:26,代码来源:ClearSentNotificationsEmailJobTest.php

示例3: process

 public function process(array $documents, &$context)
 {
     $franchiseIds = [];
     $franchiseIds[] = self::mediaToKey($context->media);
     foreach ($context->relationData as $relation) {
         if ($relation['media'] != $context->media->media) {
             continue;
         }
         if ($relation['type'] == MediaRelation::Character) {
             continue;
         }
         if (BanHelper::isFranchiseCouplingBanned($relation['media'], $relation['mal_id'], $context->media->media, $context->media->mal_id)) {
             continue;
         }
         $franchiseIds[] = self::mediaToKey($relation);
     }
     foreach (R::findAll('media', 'media||mal_id IN (' . R::genSlots($franchiseIds) . ')', $franchiseIds) as $relatedMedia) {
         $franchiseIds[] = $relatedMedia->franchise;
     }
     $franchiseId = reset($franchiseIds);
     $media =& $context->media;
     $media->franchise = $franchiseId;
     R::store($media);
     $query = 'UPDATE media SET franchise = ? WHERE franchise IN (' . R::genSlots($franchiseIds) . ')';
     R::exec($query, array_merge([$franchiseId], $franchiseIds));
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:26,代码来源:MediaSubProcessorFranchises.php

示例4: testRunAndProcessStuckJobs

 public function testRunAndProcessStuckJobs()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $emailAddress = new Email();
     $emailAddress->emailAddress = 'sometest@zurmoalerts.com';
     Yii::app()->user->userModel->primaryEmail = $emailAddress;
     $saved = Yii::app()->user->userModel->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $monitorJob = new MonitorJob();
     $this->assertEquals(0, count(JobInProcess::getAll()));
     $this->assertEquals(0, count(Notification::getAll()));
     $jobInProcess = new JobInProcess();
     $jobInProcess->type = 'Test';
     $this->assertTrue($jobInProcess->save());
     //Should make createdDateTime long enough in past to trigger as stuck.
     $createdDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 1000);
     $sql = "Update item set createddatetime = '" . $createdDateTime . "' where id = " . $jobInProcess->getClassId('Item');
     R::exec($sql);
     $jobInProcess->forget();
     $monitorJob->run();
     $this->assertEquals(1, count(Notification::getAll()));
     //Confirm an email was sent
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(1, Yii::app()->emailHelper->getSentCount());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:27,代码来源:MonitorJobTest.php

示例5: run

 /**
  * Deletes all job logs where the modifiedDateTime was more than 1 week ago.
  * Runs operation in bulk to improve performance when large jobLogs are present.
  *
  * @see BaseJob::run()
  */
 public function run()
 {
     $oneWeekAgoTimeStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 7);
     $sql = 'DELETE from item, joblog using joblog inner join item on ' . 'item.id = joblog.item_id where joblog.enddatetime <= "' . $oneWeekAgoTimeStamp . '"';
     R::exec($sql);
     return true;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:13,代码来源:JobLogCleanupJob.php

示例6: testRun

 public function testRun()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     //Create 2 imports, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
     $import = new Import();
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName());
     $modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $import->getClassId('Item');
     R::exec($sql);
     $staleImportId = $import->id;
     $import2 = new Import();
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $import2->serializedData = serialize($serializedData);
     $this->assertTrue($import2->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import2->getTempTableName());
     $this->assertEquals(2, count(Import::getAll()));
     $row = R::getRow('show tables like "' . $import->getTempTableName() . '"');
     $this->assertNotEmpty($row);
     $job = new ImportCleanupJob();
     $this->assertTrue($job->run());
     $row = R::getRow('show tables like "' . $import->getTempTableName() . '"');
     $this->assertEmpty($row);
     $imports = Import::getAll();
     $this->assertEquals(1, count($imports));
     $this->assertEquals($import2->id, $imports[0]->id);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:29,代码来源:ImportCleanupJobTest.php

示例7: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     R::exec('drop table if exists testimporttable');
     R::exec('drop table if exists testimporttable2');
     R::exec('drop table if exists testimporttable3');
     R::exec('drop table if exists testimporttable4');
     parent::tearDownAfterClass();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:ImportBaseTest.php

示例8: deleteActivityItems

 /**
  * Given a event, perform the deletion of activityItems related to the event sender.
  * @param CEvent $event
  */
 public function deleteActivityItems(CEvent $event)
 {
     $model = $event->sender;
     assert('$model instanceof Item');
     $itemId = $model->getClassId('Item');
     $sql = 'DELETE from activity_item where item_id = ' . $itemId;
     R::exec($sql);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:ActivitiesObserver.php

示例9: checkInstall

 private function checkInstall($b)
 {
     require sprintf('%s/bites/%s/config.php', \ROOT, $b->name);
     \R::exec("show tables like '{$install['table']}'");
     if (!\R::$adapter->getAffectedRows()) {
         require sprintf('%s/bites/%s/schema.php', \ROOT, $b->name);
     }
 }
开发者ID:priestd09,项目名称:Nibble-Framework,代码行数:8,代码来源:actions.ajax.class.php

示例10: insertItem

 /**
  * Insert item into modelcreationapisync table
  * @param $serviceName
  * @param $modelId
  * @param $modelClassName
  * @param $dateTime
  */
 public static function insertItem($serviceName, $modelId, $modelClassName, $dateTime)
 {
     assert('is_string($serviceName)');
     assert('is_int($modelId)');
     assert('is_string($dateTime)');
     $sql = "INSERT INTO " . self::TABLE_NAME . " VALUES (null, '{$serviceName}', '{$modelId}', '{$modelClassName}', '{$dateTime}')";
     R::exec($sql);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:ModelCreationApiSyncUtil.php

示例11: updateByModel

 /**
  * Given a model and external system id, update the external system id in the database for that model
  * @param object $model
  * @param string $externalSystemId
  */
 public static function updateByModel(RedBeanModel $model, $externalSystemId)
 {
     assert('$externalSystemId == null || is_string($externalSystemId)');
     $columnName = self::EXTERNAL_SYSTEM_ID_COLUMN_NAME;
     $tableName = $model::getTableName(get_class($model));
     RedBeanColumnTypeOptimizer::externalIdColumn($tableName, $columnName);
     R::exec("update " . $tableName . " set {$columnName} = '" . $externalSystemId . "' where id = " . $model->id);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:13,代码来源:ExternalSystemIdUtil.php

示例12: delete

 public static function delete($tableName, $conditions)
 {
     $single = [];
     foreach ($conditions as $key => $value) {
         $single[] = $key . ' = ?';
     }
     $query = sprintf('DELETE FROM %s WHERE %s', $tableName, join(' AND ', $single));
     R::exec($query, array_values($conditions));
 }
开发者ID:BrokenSilence,项目名称:malgraph4,代码行数:9,代码来源:Database.php

示例13: droptables

function droptables()
{
    R::exec('SET FOREIGN_KEY_CHECKS=0;');
    foreach (R::$writer->getTables() as $t) {
        R::exec("drop table if exists`{$t}`");
        R::exec("drop view if exists`{$t}`");
    }
    R::exec('SET FOREIGN_KEY_CHECKS=1;');
}
开发者ID:ryjkov,项目名称:redbean,代码行数:9,代码来源:jsontest.php

示例14: deleteRowsFromAllTablesExceptLog

 public static function deleteRowsFromAllTablesExceptLog()
 {
     assert('RedBeanDatabase::isSetup()');
     $tableNames = DatabaseCompatibilityUtil::getAllTableNames();
     foreach ($tableNames as $tableName) {
         if ($tableName != 'log') {
             R::exec("delete from {$tableName}");
         }
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:TestDatabaseUtil.php

示例15: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     $account = AccountTestHelper::createAccountByNameForOwner('anAccount2', Yii::app()->user->userModel);
     $task = TaskTestHelper::createTaskWithOwnerAndRelatedAccount('startTask', $super, $account);
     $task->delete();
     R::exec('delete from activity_item');
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:ActivitiesObserverTest.php


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