Completed
Push — ezp-31420-merge-up ( ec14fb...141a64 )
by
unknown
40:13 queued 27:42
created

PostgresConnectionHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAutoIncrementValue() 0 4 1
A getSequenceName() 0 4 1
A quoteIdentifier() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler;
8
9
use eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler;
10
11
class PostgresConnectionHandler extends ConnectionHandler
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Publish\Core\Persiste...trine\ConnectionHandler has been deprecated with message: Since 6.13, please use Doctrine DBAL instead (@ezpublish.persistence.connection) it provides richer and more powerful DB abstraction which is also easier to use.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
12
{
13
    /**
14
     * Get auto increment value.
15
     *
16
     * Returns the value used for autoincrement tables. Usually this will just
17
     * be null. In case for sequence based RDBMS this method can return a
18
     * proper value for the given column.
19
     *
20
     * @param string $table
21
     * @param string $column
22
     *
23
     * @return mixed
24
     */
25
    public function getAutoIncrementValue($table, $column)
26
    {
27
        return "nextval('" . $this->getSequenceName($table, $column) . "')";
28
    }
29
30
    /**
31
     * Returns the name of the affected sequence.
32
     *
33
     * @param string $table
34
     * @param string $column
35
     *
36
     * @return string
37
     */
38
    public function getSequenceName($table, $column)
39
    {
40
        return sprintf('%s_%s_seq', $table, $column);
41
    }
42
43
    /**
44
     * Custom quote identifier method.
45
     *
46
     * @param string $identifier
47
     *
48
     * @return string
49
     */
50
    public function quoteIdentifier($identifier)
51
    {
52
        return '"' . $identifier . '"';
53
    }
54
}
55