Adapter
1 month ago
Schema
2 weeks ago
Adapter.php
1 month ago
AdapterInterface.php
1 month ago
BatchInsert.php
6 months ago
Schema.php
1 month ago
SchemaInterface.php
1 month ago
Settings.php
1 year ago
TransactionLevel.php
1 year ago
TransactionalDatabaseDynamicTrait.php
1 year ago
TransactionalDatabaseInterface.php
1 year ago
TransactionalDatabaseStaticTrait.php
1 year ago
TransactionalDatabaseStaticTrait.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Piwik\Db; |
| 4 | |
| 5 | trait TransactionalDatabaseStaticTrait |
| 6 | { |
| 7 | private $supportsTransactionLevelForNonLockingReads; |
| 8 | public function setTransactionIsolationLevel(string $level) : void |
| 9 | { |
| 10 | static::query("SET SESSION TRANSACTION ISOLATION LEVEL {$level}"); |
| 11 | } |
| 12 | public function getCurrentTransactionIsolationLevelForSession() : string |
| 13 | { |
| 14 | try { |
| 15 | return static::fetchOne('SELECT @@TX_ISOLATION'); |
| 16 | } catch (\Exception $e) { |
| 17 | return static::fetchOne('SELECT @@transaction_isolation'); |
| 18 | } |
| 19 | } |
| 20 | public function setSupportsTransactionLevelForNonLockingReads(?bool $supports = null) : void |
| 21 | { |
| 22 | $this->supportsTransactionLevelForNonLockingReads = $supports; |
| 23 | } |
| 24 | public function getSupportsTransactionLevelForNonLockingReads() : ?bool |
| 25 | { |
| 26 | return $this->supportsTransactionLevelForNonLockingReads; |
| 27 | } |
| 28 | } |
| 29 |