PreparedQueryManager::query()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
/*
3
 * This file is part of the Pomm's Foundation package.
4
 *
5
 * (c) 2014 - 2017 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\Foundation\PreparedQuery;
11
12
use PommProject\Foundation\ConvertedResultIterator;
13
use PommProject\Foundation\QueryManager\QueryManagerClient;
14
15
/**
16
 * PreparedQueryManager
17
 *
18
 * Query manager using the prepared_statement client.
19
 *
20
 * @package   Foundation
21
 * @copyright 2014 - 2017 Grégoire HUBERT
22
 * @author    Grégoire HUBERT
23
 * @license   X11 {@link http://opensource.org/licenses/mit-license.php}
24
 * @see       SimpleQuery
25
 */
26
class PreparedQueryManager extends QueryManagerClient
27
{
28
    /**
29
     * query
30
     *
31
     * @see QueryManagerInterface
32
     */
33
    public function query($sql, array $parameters = [])
34
    {
35
        $resource = $this
36
            ->getSession()
37
            ->getClientUsingPooler('prepared_query', $sql)
38
            ->execute($parameters)
39
            ;
40
41
        return new ConvertedResultIterator(
42
            $resource,
43
            $this->getSession()
44
        );
45
    }
46
}
47