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


PHP Connection::beginTransaction方法代码示例

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


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

示例1: storeMultiple

 /**
  * Save multiple notifications sent
  * at once.
  *
  * @param  array $notifications
  * @return mixed
  */
 public function storeMultiple(array $notifications)
 {
     $this->db->beginTransaction();
     $stackId = $this->db->table($this->notification->getTable())->max('stack_id') + 1;
     foreach ($notifications as $key => $notification) {
         $notifications[$key]['stack_id'] = $stackId;
     }
     $insert = $this->db->table($this->notification->getTable())->insert($notifications);
     $this->db->commit();
     return $insert;
 }
开发者ID:fenos,项目名称:notifynder,代码行数:18,代码来源:NotificationRepository.php

示例2: append

 /**
  * @param mixed $id
  * @param DomainEventStream $eventStream
  */
 public function append($id, DomainEventStream $eventStream)
 {
     $id = (string) $id;
     //Used to thrown errors if ID will not cast to string
     $this->db->beginTransaction();
     try {
         foreach ($eventStream as $domainMessage) {
             $this->insertEvent($domainMessage);
         }
         $this->db->commit();
     } catch (QueryException $ex) {
         $this->db->rollBack();
         throw $ex;
     }
 }
开发者ID:jrdnhannah,项目名称:CQRS-ES-Framework-Laravel,代码行数:19,代码来源:LaravelEventStore.php

示例3: deleteReserved

 /**
  * Delete a reserved job from the queue.
  *
  * @param  string  $queue
  * @param  string  $id
  * @return void
  */
 public function deleteReserved($queue, $id)
 {
     $this->database->beginTransaction();
     if ($this->database->table($this->table)->lockForUpdate()->find($id)) {
         $this->database->table($this->table)->where('id', $id)->delete();
     }
     $this->database->commit();
 }
开发者ID:timpressive,项目名称:art-auction,代码行数:15,代码来源:DatabaseQueue.php

示例4: getNextAvailableJob

 /**
  * Get the next available job for the queue.
  *
  * @param string|null $queue        	
  * @return \StdClass|null
  */
 protected function getNextAvailableJob($queue)
 {
     $this->database->beginTransaction();
     $job = $this->database->table($this->table)->lockForUpdate()->where('queue', $this->getQueue($queue))->where('reserved', 0)->where('available_at', '<=', $this->getTime())->orderBy('id', 'asc')->first();
     return $job ? (object) $job : null;
 }
开发者ID:sapwoo,项目名称:portfolio,代码行数:12,代码来源:DatabaseQueue.php

示例5: setCurrent

 /**
  * Database 연길 할 때 transaction 이 진행 중이라면 연결하려는 $connection 의 transaction 시작
  * \Illuminiate\Database\Connection 의 transaction level 은 0 또는 1 로 제한.
  * transaction level 은 transaction handler 로 제어.
  *
  * @param Connection $connection connection
  * @return void
  */
 public function setCurrent(Connection $connection)
 {
     if ($this->transactionLevel() > 0 && $connection->transactionLevel() === 0) {
         $connection->beginTransaction();
     }
 }
开发者ID:xpressengine,项目名称:xpressengine,代码行数:14,代码来源:TransactionHandler.php


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