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


PHP DibiConnection::commit方法代码示例

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


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

示例1: store

 /**
  * Store authorization code
  * @param IAuthorizationCode $authorizationCode
  * @throws InvalidScopeException
  */
 public function store(IAuthorizationCode $authorizationCode)
 {
     $this->context->insert($this->getTable(), array('authorization_code' => $authorizationCode->getAuthorizationCode(), 'client_id' => $authorizationCode->getClientId(), 'user_id' => $authorizationCode->getUserId(), 'expires_at' => $authorizationCode->getExpires()))->execute();
     $this->context->begin();
     try {
         foreach ($authorizationCode->getScope() as $scope) {
             $this->context->insert($this->getScopeTable(), array('authorization_code' => $authorizationCode->getAuthorizationCode(), 'scope_name' => $scope))->execute();
         }
     } catch (\PDOException $e) {
         // MySQL error 1452 - Cannot add or update a child row: a foreign key constraint fails
         if (in_array(1452, $e->errorInfo)) {
             throw new InvalidScopeException();
         }
         throw $e;
     }
     $this->context->commit();
 }
开发者ID:drahak,项目名称:oauth2,代码行数:22,代码来源:AuthorizationCodeStorage.php

示例2: refreshToken

 /**
  * @inheritDoc
  */
 function refreshToken($refreshToken)
 {
     $this->purgeOldTokens();
     $token = $this->refreshTokenToToken($refreshToken);
     $this->dbConnection->begin();
     // Check for existing token and lock it
     $existingToken = $this->dbConnection->query('SELECT * FROM %n', $this->tableName, 'WHERE [token] = %s', $token, 'FOR UPDATE')->fetch();
     // No matching token found
     if ($existingToken === FALSE) {
         $this->dbConnection->rollback();
         return FALSE;
     }
     $newToken = $this->generateNewToken();
     $dt = new \DateTime();
     $dt->modify("+" . $this->tokenTtl . " seconds");
     $this->dbConnection->query('UPDATE %n', $this->tableName, 'SET [token] = %s,', $newToken, '[expires] = %t', $dt, 'WHERE [token] = %s', $token);
     $this->dbConnection->commit();
     return new Token($newToken, $this->tokenTtl, $this->generateRefreshToken($newToken), $existingToken->parameters);
 }
开发者ID:vbuilder,项目名称:framework,代码行数:22,代码来源:DatabaseTokenManager.php

示例3: commit

 /**
  * Commit transaction
  *
  * @param null $savepoint
  *
  * @throws \DibiException
  */
 public function commit($savepoint = NULL)
 {
     $this->database->commit($savepoint);
 }
开发者ID:bombush,项目名称:NatsuCon,代码行数:11,代码来源:EntityModel.php

示例4: commit

 /**
  * Potvrdí transakci.
  * @param string $savepoint
  */
 public function commit($savepoint = NULL)
 {
     $this->connection->commit($savepoint);
 }
开发者ID:JZechy,项目名称:ZBox,代码行数:8,代码来源:DbUtils.php


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