| 1 | <?php |
||
| 15 | class Connection extends \yii\db\Connection |
||
| 16 | { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @inheritdoc |
||
| 20 | */ |
||
| 21 | public $schemaMap = [ |
||
| 22 | 'firebird' => 'edgardmessias\db\firebird\Schema', // Firebird |
||
| 23 | ]; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @inheritdoc |
||
| 27 | */ |
||
| 28 | public $pdoClass = 'edgardmessias\db\firebird\PdoAdapter'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @inheritdoc |
||
| 32 | */ |
||
| 33 | public $commandClass = 'edgardmessias\db\firebird\Command'; |
||
| 34 | /** |
||
| 35 | * @var Transaction the currently active transaction |
||
| 36 | */ |
||
| 37 | private $_transaction; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Returns the currently active transaction. |
||
| 41 | * @return Transaction the currently active transaction. Null if no active transaction. |
||
| 42 | */ |
||
| 43 | 4 | public function getTransaction() |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Starts a transaction. |
||
| 50 | * @param string|null $isolationLevel The isolation level to use for this transaction. |
||
| 51 | * See [[Transaction::begin()]] for details. |
||
| 52 | * @return Transaction the transaction initiated |
||
| 53 | */ |
||
| 54 | public function beginTransaction($isolationLevel = null) |
||
| 55 | { |
||
| 56 | $this->open(); |
||
| 57 | |||
| 58 | if (($transaction = $this->getTransaction()) === null) { |
||
| 59 | $transaction = $this->_transaction = new Transaction(['db' => $this]); |
||
| 60 | } |
||
| 61 | $transaction->begin($isolationLevel); |
||
| 62 | |||
| 63 | return $transaction; |
||
| 64 | } |
||
| 65 | |||
| 66 | 109 | public function close() |
|
| 73 | } |
||
| 74 |