CratePlatform4   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
eloc 22
c 2
b 0
f 0
dl 0
loc 67
ccs 28
cts 28
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getVarcharTypeDeclarationSQLSnippet() 0 3 1
A getFloatDeclarationSQL() 0 3 1
A getClobTypeDeclarationSQL() 0 3 1
A getSmallIntTypeDeclarationSQL() 0 3 1
A getBigIntTypeDeclarationSQL() 0 3 1
A initializeDoctrineTypeMappings() 0 21 1
1
<?php
2
3
/**
4
 * Licensed to CRATE Technology GmbH("Crate") under one or more contributor
5
 * license agreements.  See the NOTICE file distributed with this work for
6
 * additional information regarding copyright ownership.  Crate licenses
7
 * this file to you under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.  You may
9
 * obtain a copy of the License at
10
 *
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
16
 * License for the specific language governing permissions and limitations
17
 * under the License.
18
 *
19
 * However, if you have executed another commercial license agreement
20
 * with Crate these terms will supersede the license and you may use the
21
 * software solely pursuant to the terms of the relevant commercial agreement.
22
 */
23
24
namespace Crate\DBAL\Platforms;
25
26
class CratePlatform4 extends CratePlatform1
27
{
28
    /**
29
     * {@inheritDoc}
30
     */
31 242
    protected function initializeDoctrineTypeMappings(): void
32
    {
33 242
        $this->doctrineTypeMapping = array(
34 242
                'integer'       => 'integer',
35 242
                'int'           => 'integer',
36 242
                'bool'          => 'boolean',
37 242
                'boolean'       => 'boolean',
38 242
                'timestamp'     => 'timestamp',
39
40 242
                'object'        => 'map',
41 242
                'array'         => 'array',
42
43
                // postgresql compatible type names, default for CrateDB >= 4.0
44 242
                'text'          => 'string',
45 242
                'char'          => 'string',
46 242
                'smallint'      => 'smallint',
47 242
                'bigint'        => 'bigint',
48 242
                'real'          => 'float',
49 242
                'double precision' => 'float',
50 242
                'timestamp without time zone' => 'timestamp',
51 242
                'timestamp with time zone' => 'timestamp',
52 242
        );
53
    }
54
55
    /**
56
     * {@inheritDoc}
57
     */
58 2
    public function getBigIntTypeDeclarationSQL(array $field): string
59
    {
60 2
        return 'BIGINT';
61
    }
62
63
    /**
64
     * {@inheritDoc}
65
     */
66 2
    public function getSmallIntTypeDeclarationSQL(array $field): string
67
    {
68 2
        return 'SMALLINT';
69
    }
70
71
    /**
72
     * {@inheritDoc}
73
     */
74 74
    public function getFloatDeclarationSQL(array $field): string
75
    {
76 74
        return 'DOUBLE PRECISION';
77
    }
78
79
    /**
80
     * {@inheritDoc}
81
     */
82 118
    protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed): string
83
    {
84 118
        return 'TEXT';
85
    }
86
87
    /**
88
     * {@inheritDoc}
89
     */
90 2
    public function getClobTypeDeclarationSQL(array $field): string
91
    {
92 2
        return 'TEXT';
93
    }
94
}
95