Passed
Pull Request — master (#2893)
by Šimon
12:39
created

PostgreSQL100Platform   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSequenceMetadataSQL() 0 5 1
A getReservedKeywordsClass() 0 3 1
A cleanSequenceNameFromSchemaName() 0 3 1
1
<?php
2
3
namespace Doctrine\DBAL\Platforms;
4
5
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords;
6
7
/**
8
 * Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform.
9
 *
10
 * @link   www.doctrine-project.org
11
 * @since  2.6
12
 */
13
class PostgreSQL100Platform extends PostgreSQL94Platform
14
{
15
	/**
16
	 * {@inheritdoc}
17
	 */
18 51
	protected function getReservedKeywordsClass() : string
19
	{
20 51
		return PostgreSQL100Keywords::class;
21
	}
22
23 1
	public function getSequenceMetadataSQL(string $rawSequenceName, string $schemaName) : string
24
	{
25 1
		$sequenceName = $this->cleanSequenceNameFromSchemaName($rawSequenceName, $schemaName);
26
27 1
		return 'SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = '.$this->quoteStringLiteral($schemaName).' AND sequencename = ' . $this->quoteStringLiteral($sequenceName);
28
	}
29
30 1
	private function cleanSequenceNameFromSchemaName(string $rawSequenceName, string $schemaName) : string
31
	{
32 1
		return str_replace($schemaName . '.', '', $rawSequenceName);
33
	}
34
}
35