1 | <?php |
||
33 | class Column extends Reference |
||
34 | { |
||
35 | /** @var DataType */ |
||
36 | private $type; |
||
37 | |||
38 | /** @var boolean */ |
||
39 | private $nullable = true; |
||
40 | |||
41 | /** @var string */ |
||
42 | private $defval; |
||
43 | |||
44 | /** @var boolean */ |
||
45 | private $primary = false; |
||
46 | |||
47 | /** |
||
48 | * @return Column |
||
49 | */ |
||
50 | 12 | public function integer() |
|
54 | |||
55 | /** |
||
56 | * @param int $length |
||
57 | * @return Column |
||
58 | */ |
||
59 | 3 | public function varchar($length) |
|
63 | |||
64 | /** |
||
65 | * @return Column |
||
66 | */ |
||
67 | 3 | public function bigint() |
|
71 | |||
72 | /** |
||
73 | * @return Column |
||
74 | */ |
||
75 | 3 | public function timestamp() |
|
79 | |||
80 | /** |
||
81 | * @param DataType $type |
||
82 | * @return Column |
||
83 | */ |
||
84 | 24 | public function type(DataType $type) |
|
89 | |||
90 | /** |
||
91 | * Set NOT NULL option. |
||
92 | * |
||
93 | * @return Column |
||
94 | */ |
||
95 | 3 | public function required() |
|
100 | |||
101 | /** |
||
102 | * Set default value. |
||
103 | * |
||
104 | * @param mixed $val |
||
105 | * @return Column |
||
106 | */ |
||
107 | 3 | public function defval($val) |
|
112 | |||
113 | /** |
||
114 | * Defines the column as primary key. |
||
115 | * |
||
116 | * @return Column |
||
117 | */ |
||
118 | 3 | public function primary() |
|
123 | |||
124 | /** |
||
125 | * @inheritDoc |
||
126 | */ |
||
127 | 27 | public function compile(DriverInterface $driver) |
|
138 | |||
139 | /** |
||
140 | * @param string $compiled |
||
141 | * @return string |
||
142 | */ |
||
143 | 3 | private function compilePrimary($compiled) |
|
147 | |||
148 | /** |
||
149 | * @param DriverInterface $driver |
||
150 | * @param string $compiled |
||
151 | * @return string |
||
152 | */ |
||
153 | 21 | private function compileRegular(DriverInterface $driver, $compiled) |
|
163 | } |
||
164 |