Completed
Pull Request — 2.0 (#75)
by Julien
04:02
created

PreparedQueryManager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 21
c 2
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A query() 0 13 1
1
<?php
2
/*
3
 * This file is part of the Pomm's Foundation package.
4
 *
5
 * (c) 2014 - 2015 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 - 2015 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