Completed
Push — master ( c81dc7...eea340 )
by Edgard
14:07
created

Command   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 40
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B queryInternal() 0 28 3
1
<?php
2
3
/**
4
 * @link http://www.yiiframework.com/
5
 * @copyright Copyright (c) 2008 Yii Software LLC
6
 * @license http://www.yiiframework.com/license/
7
 */
8
9
namespace edgardmessias\db\ibm\db2;
10
11
use Exception;
12
use Yii;
13
14
/**
15
 * @author Edgard Messias <[email protected]>
16
 * @since 1.0
17
 */
18
class Command extends \yii\db\Command
19
{
20
    /**
21
     * Performs the actual DB query of a SQL statement.
22
     * @param string $method method of PDOStatement to be called
23
     * @param integer $fetchMode the result fetch mode. Please refer to [PHP manual](http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php)
24
     * for valid fetch modes. If this parameter is null, the value set in [[fetchMode]] will be used.
25
     * @return mixed the method execution result
26
     * @throws yii\db\Exception if the query causes any problem
27
     * @since 2.0.1 this method is protected (was private before).
28
     */
29 135
    protected function queryInternal($method, $fetchMode = null)
30
    {
31 135
        if ($method !== '') {
32 134
            return parent::queryInternal($method, $fetchMode);
33
        }
34
        
35 3
        $rawSql = $this->getRawSql();
36
37 3
        Yii::info($rawSql, 'yii\db\Command::query');
38
39 3
        $this->prepare(true);
40
41 3
        $token = $rawSql;
42
        try {
43 3
            Yii::beginProfile($token, 'yii\db\Command::query');
44
45 3
            $this->pdoStatement->execute();
46
47 3
            $result = new DataReader($this);
48
49 3
            Yii::endProfile($token, 'yii\db\Command::query');
50 3
        } catch (Exception $e) {
51 1
            Yii::endProfile($token, 'yii\db\Command::query');
52 1
            throw $this->db->getSchema()->convertException($e, $rawSql);
53
        }
54
55 3
        return $result;
56
    }
57
}
58