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