QueryBuilder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 30
c 1
b 0
f 0
dl 0
loc 40
ccs 5
cts 5
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Pgsql;
6
7
use Yiisoft\Db\QueryBuilder\AbstractQueryBuilder;
8
use Yiisoft\Db\Schema\QuoterInterface;
9
use Yiisoft\Db\Schema\SchemaInterface;
10
11
/**
12
 * Implements the PostgreSQL Server specific query builder.
13
 */
14
final class QueryBuilder extends AbstractQueryBuilder
15
{
16
    /**
17
     * @var array Mapping from abstract column types (keys) to physical column types (values).
18
     *
19
     * @psalm-var string[]
20
     */
21
    protected array $typeMap = [
22
        SchemaInterface::TYPE_PK => 'serial NOT NULL PRIMARY KEY',
23
        SchemaInterface::TYPE_UPK => 'serial NOT NULL PRIMARY KEY',
24
        SchemaInterface::TYPE_BIGPK => 'bigserial NOT NULL PRIMARY KEY',
25
        SchemaInterface::TYPE_UBIGPK => 'bigserial NOT NULL PRIMARY KEY',
26
        SchemaInterface::TYPE_CHAR => 'char(1)',
27
        SchemaInterface::TYPE_STRING => 'varchar(255)',
28
        SchemaInterface::TYPE_TEXT => 'text',
29
        SchemaInterface::TYPE_TINYINT => 'smallint',
30
        SchemaInterface::TYPE_SMALLINT => 'smallint',
31
        SchemaInterface::TYPE_INTEGER => 'integer',
32
        SchemaInterface::TYPE_BIGINT => 'bigint',
33
        SchemaInterface::TYPE_FLOAT => 'double precision',
34
        SchemaInterface::TYPE_DOUBLE => 'double precision',
35
        SchemaInterface::TYPE_DECIMAL => 'numeric(10,0)',
36
        SchemaInterface::TYPE_DATETIME => 'timestamp(0)',
37
        SchemaInterface::TYPE_TIMESTAMP => 'timestamp(0)',
38
        SchemaInterface::TYPE_TIME => 'time(0)',
39
        SchemaInterface::TYPE_DATE => 'date',
40
        SchemaInterface::TYPE_BINARY => 'bytea',
41
        SchemaInterface::TYPE_BOOLEAN => 'boolean',
42
        SchemaInterface::TYPE_MONEY => 'numeric(19,4)',
43
        SchemaInterface::TYPE_JSON => 'jsonb',
44
        SchemaInterface::TYPE_UUID => 'uuid',
45
        SchemaInterface::TYPE_UUID_PK => 'uuid PRIMARY KEY',
46
    ];
47
48 611
    public function __construct(QuoterInterface $quoter, SchemaInterface $schema)
49
    {
50 611
        $ddlBuilder = new DDLQueryBuilder($this, $quoter, $schema);
51 611
        $dmlBuilder = new DMLQueryBuilder($this, $quoter, $schema);
52 611
        $dqlBuilder = new DQLQueryBuilder($this, $quoter);
53 611
        parent::__construct($quoter, $schema, $ddlBuilder, $dmlBuilder, $dqlBuilder);
54
    }
55
}
56