Exemplo n.º 1
0
 /**
  * Helper function for generation and getting lock for new
  * random token
  *
  * @return string new token
  */
 protected function generateNewToken()
 {
     // Generate new key
     for ($i = 0;; $i++) {
         if ($i > 10) {
             $this->dbConnection->rollback();
             throw new Nette\InvalidStateException("Couldn't generate unused token");
         }
         $newToken = $this->generateToken();
         if ($this->dbConnection->query('SELECT * FROM %n', $this->tableName, 'WHERE [token] = %s', $newToken, 'FOR UPDATE')->fetch() === FALSE) {
             break;
         }
     }
     return $newToken;
 }
Exemplo n.º 2
0
 /**
  * Rollback transaction
  *
  * @param null $savepoint
  *
  * @throws \DibiException
  */
 public function rollback($savepoint = NULL)
 {
     $this->database->rollback($savepoint);
 }
Exemplo n.º 3
0
 /**
  * Vrátí prováděnou transakci.
  * @param string $savepoint
  * @throws \DibiException
  */
 public function rollback($savepoint = NULL)
 {
     $this->connection->rollback($savepoint);
 }