Passed
Push — dev ( 214347...f9bbea )
by Def
27:01 queued 23:58
created

TransactionPDOMssql::setIsolationLevel()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
ccs 0
cts 6
cp 0
crap 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Mssql\PDO;
6
7
use Throwable;
8
use Yiisoft\Db\Exception\Exception;
9
use Yiisoft\Db\Exception\InvalidConfigException;
10
use Yiisoft\Db\Exception\NotSupportedException;
11
use Yiisoft\Db\Transaction\TransactionPDO;
12
13
final class TransactionPDOMssql extends TransactionPDO
14
{
15
    /**
16
     * Creates a new savepoint.
17
     *
18
     * @param string $name the savepoint name.
19
     *
20
     * @throws Exception|InvalidConfigException|Throwable
21
     */
22 4
    public function createSavepoint(string $name): void
23
    {
24 4
        $this->db->createCommand("SAVE TRANSACTION $name")->execute();
25
    }
26
27
    /**
28
     * Releases an existing savepoint.
29
     *
30
     * @param string $name the savepoint name.
31
     *
32
     * @throws NotSupportedException
33
     */
34
    public function releaseSavepoint(string $name): void
35
    {
36
        // does nothing as MSSQL does not support this
37
    }
38
39
    /**
40
     * Rolls back to a previously created savepoint.
41
     *
42
     * @param string $name the savepoint name.
43
     *
44
     * @throws Exception|InvalidConfigException|Throwable
45
     */
46 3
    public function rollBackSavepoint(string $name): void
47
    {
48 3
        $this->db->createCommand("ROLLBACK TRANSACTION $name")->execute();
49
    }
50
}
51