Completed
Push — master ( 6adfd5...8dd9a1 )
by Rasmus
02:23
created

MySQLDatabase::select()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace mindplay\sql\mysql;
4
5
use mindplay\sql\framework\Database;
6
use mindplay\sql\framework\Driver;
7
use mindplay\sql\model\DeleteQuery;
8
use mindplay\sql\model\InsertQuery;
9
use mindplay\sql\model\SelectQuery;
10
use mindplay\sql\model\Table;
11
use mindplay\sql\model\UpdateQuery;
12
use mindplay\sql\types\BoolType;
13
14
class MySQLDatabase extends Database
15
{
16 1
    public function __construct()
17
    {
18 1
        parent::__construct();
19
        
20 1
        $this->container->register(BoolType::class, function () {
21 1
            return BoolType::asInt();
22 1
        });
23 1
    }
24
25
    /**
26
     * @param Table $from
27
     *
28
     * @return SelectQuery
29
     */
30 1
    public function select(Table $from)
31
    {
32 1
        return $this->container->create(SelectQuery::class, ['root' => $from]);
33
    }
34
35
    /**
36
     * @param Table $into
37
     *
38
     * @return InsertQuery
39
     */
40 1
    public function insert(Table $into)
41
    {
42 1
        return $this->container->create(InsertQuery::class, ['table' => $into]);
43
    }
44
45
    /**
46
     * @param Table $table
47
     *
48
     * @return UpdateQuery
49
     */
50 1
    public function update(Table $table)
51
    {
52 1
        return $this->container->create(UpdateQuery::class, ['root' => $table]);
53
    }
54
55
    /**
56
     * @param Table $table
57
     *
58
     * @return DeleteQuery
59
     */
60 1
    public function delete(Table $table)
61
    {
62 1
        return $this->container->create(DeleteQuery::class, ['root' => $table]);
63
    }
64
65
    /**
66
     * @return Driver
67
     */
68 1
    protected function createDriver()
69
    {
70 1
        return new MySQLDriver();
71
    }
72
}
73