ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDatabaseCommonTestMockData.php
Go to the documentation of this file.
1<?php
2
9{
10
14 public function getNow()
15 {
16 return "NOW()";
17 }
18
19
23 public function getLike()
24 {
25 return " UPPER(column) LIKE(UPPER('22'))";
26 }
27
28
32 public function getLocate()
33 {
34 return " LOCATE( needle,mystring,5) ";
35 }
36
37
41 public function getConcat($allow_null = true)
42 {
43 if ($allow_null) {
44 return " CONCAT(COALESCE(o,''),COALESCE(t,''),COALESCE(t,'')) ";
45 } else {
46 return " CONCAT(o,t,t) ";
47 }
48 }
49
50
54 public function getDBFields()
55 {
56 $fields = array(
57 'id' => array(
58 'type' => 'integer',
59 'length' => 4,
60 'notnull' => true,
61 ),
62 'is_online' => array(
63 'type' => 'integer',
64 'length' => 1,
65 'notnull' => false,
66 ),
67 'is_default' => array(
68 'type' => 'integer',
69 'length' => 1,
70 'notnull' => false,
71 'default' => 1,
72 ),
73 'latitude' => array(
74 'type' => 'float',
75 ),
76 'longitude' => array(
77 'type' => 'float',
78 ),
79 'elevation' => array(
80 'type' => 'float',
81 ),
82 'address' => array(
83 'type' => 'text',
84 'length' => 256,
85 'notnull' => false,
86 ),
87 'init_mob_id' => array(
88 'type' => 'integer',
89 'length' => 4,
90 'notnull' => false,
91 ),
92 'comment_mob_id' => array(
93 'type' => 'integer',
94 'length' => 4,
95 ),
96 'container_id' => array(
97 'type' => 'integer',
98 'length' => 4,
99 ),
100 'big_data' => array(
101 'type' => 'clob',
102 ),
103 );
104
105 return $fields;
106 }
107
108
114 public function getInputArray($update_mob_id = false, $blob_null = true, $with_clob = true)
115 {
116 $fields = array(
117 'id' => array(
118 'integer',
119 56,
120 ),
121 'is_online' => array(
122 'integer',
123 true,
124 ),
125 'is_default' => array(
126 'integer',
127 false,
128 ),
129 'latitude' => array(
130 'float',
131 47.059830,
132 ),
133 'longitude' => array(
134 'float',
135 7.624028,
136 ),
137 'elevation' => array(
138 'float',
139 2.56,
140 ),
141 'address' => array(
142 'text',
143 'Farbweg 9, 3400 Burgdorf',
144 ),
145 'init_mob_id' => array(
146 'integer',
147 $update_mob_id ? $update_mob_id : 78,
148 ),
149 'comment_mob_id' => array(
150 'integer',
151 69,
152 ),
153 'container_id' => array(
154 'integer',
155 456,
156 ),
157 );
158 if ($with_clob) {
159 $fields['big_data'] = array(
160 'clob',
161 $blob_null ? null : 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
162 );
163 }
164
165 return $fields;
166 }
167
168
173 {
174 $fields = array(
175 'id' => array(
176 'integer',
177 123456,
178 ),
179 'is_online' => array(
180 'integer',
181 true,
182 ),
183 'is_default' => array(
184 'integer',
185 false,
186 ),
187 );
188
189 return $fields;
190 }
191
192
197 abstract public function getInsertQuery($table_name);
198
199
203 public function getTableCreateSQL($tablename, $engine)
204 {
205 return "CREATE TABLE `" . $tablename . "` (
206 `id` int(11) NOT NULL,
207 `is_online` tinyint(4) DEFAULT NULL,
208 `is_default` tinyint(4) DEFAULT '1',
209 `latitude` double DEFAULT NULL,
210 `longitude` double DEFAULT NULL,
211 `elevation` double DEFAULT NULL,
212 `address` varchar(256) DEFAULT NULL,
213 `init_mob_id` int(11) DEFAULT NULL,
214 `comment_mob_id` int(11) DEFAULT NULL,
215 `container_id` int(11) DEFAULT NULL,
216 `big_data` longtext,
217 PRIMARY KEY (`id`)) ENGINE=$engine DEFAULT CHARSET=utf8";
218 }
219
220
224 public function getTableCreateSQLAfterRename($tablename, $engine, $supports_fulltext)
225 {
226 $add_idex = '';
227 if ($supports_fulltext) {
228 $add_idex = ", FULLTEXT KEY `i2_idx` (`address`)";
229 }
230
231 return "CREATE TABLE `" . $tablename . "` (
232 `id` int(11) NOT NULL,
233 `is_online` tinyint(4) DEFAULT NULL,
234 `is_default` tinyint(4) DEFAULT '1',
235 `latitude` double DEFAULT NULL,
236 `longitude` double DEFAULT NULL,
237 `elevation` double DEFAULT NULL,
238 `address` varchar(256) DEFAULT NULL,
239 `init_mob_id` int(11) DEFAULT NULL,
240 `comment_mob_id_altered` int(11) DEFAULT NULL,
241 `container_id` int(11) DEFAULT NULL,
242 `big_data` longtext,
243 PRIMARY KEY (`id`), KEY `i1_idx` (`init_mob_id`)$add_idex) ENGINE=$engine DEFAULT CHARSET=utf8";
244 }
245
246
250 public function getTableCreateSQLAfterAlter($tablename, $engine, $supports_fulltext)
251 {
252 $add_idex = '';
253 if ($supports_fulltext) {
254 $add_idex = ", FULLTEXT KEY `i2_idx` (`address`)";
255 }
256
257 return "CREATE TABLE `" . $tablename . "` (
258 `id` int(11) NOT NULL,
259 `is_online` tinyint(4) DEFAULT NULL,
260 `is_default` tinyint(4) DEFAULT '1',
261 `latitude` double DEFAULT NULL,
262 `longitude` double DEFAULT NULL,
263 `elevation` double DEFAULT NULL,
264 `address` varchar(256) DEFAULT NULL,
265 `init_mob_id` int(11) DEFAULT NULL,
266 `comment_mob_id_altered` varchar(250) DEFAULT NULL,
267 `container_id` int(11) DEFAULT NULL,
268 `big_data` longtext,
269 PRIMARY KEY (`id`), KEY `i1_idx` (`init_mob_id`)$add_idex) ENGINE=$engine DEFAULT CHARSET=utf8";
270 }
271}
An exception for terminatinating execution or to throw for unit testing.
Class ilDatabaseCommonTestMockData.
getInputArray($update_mob_id=false, $blob_null=true, $with_clob=true)
getTableCreateSQLAfterAlter($tablename, $engine, $supports_fulltext)
getTableCreateSQLAfterRename($tablename, $engine, $supports_fulltext)
$engine
Definition: workflow.php:89