/
PostgresConnectionHandler.php
56 lines (51 loc) · 1.41 KB
/
PostgresConnectionHandler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* File containing an interface for the Doctrine database abstractions.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler;
use eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler;
class PostgresConnectionHandler extends ConnectionHandler
{
/**
* Get auto increment value.
*
* Returns the value used for autoincrement tables. Usually this will just
* be null. In case for sequence based RDBMS this method can return a
* proper value for the given column.
*
* @param string $table
* @param string $column
*
* @return mixed
*/
public function getAutoIncrementValue($table, $column)
{
return "nextval('" . $this->getSequenceName($table, $column) . "')";
}
/**
* Returns the name of the affected sequence.
*
* @param string $table
* @param string $column
*
* @return string
*/
public function getSequenceName($table, $column)
{
return sprintf('%s_%s_seq', $table, $column);
}
/**
* Custom quote identifier method.
*
* @param string $identifier
*
* @return string
*/
public function quoteIdentifier($identifier)
{
return '"' . $identifier . '"';
}
}