ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDatabaseCommonTestMockData.php
Go to the documentation of this file.
1 <?php
2 
9 
13  public function getNow() {
14  return "NOW()";
15  }
16 
17 
21  public function getLike() {
22  return " UPPER(column) LIKE(UPPER('22'))";
23  }
24 
25 
29  public function getLocate() {
30  return " LOCATE( needle,mystring,5) ";
31  }
32 
33 
37  public function getConcat($allow_null = true) {
38  if ($allow_null) {
39  return " CONCAT(COALESCE(o,''),COALESCE(t,''),COALESCE(t,'')) ";
40  }else {
41  return " CONCAT(o,t,t) ";
42  }
43  }
44 
45 
49  public function getDBFields() {
50  $fields = array(
51  'id' => array(
52  'type' => 'integer',
53  'length' => 4,
54  'notnull' => true,
55  ),
56  'is_online' => array(
57  'type' => 'integer',
58  'length' => 1,
59  'notnull' => false,
60  ),
61  'is_default' => array(
62  'type' => 'integer',
63  'length' => 1,
64  'notnull' => false,
65  'default' => 1,
66  ),
67  'latitude' => array(
68  'type' => 'float',
69  ),
70  'longitude' => array(
71  'type' => 'float',
72  ),
73  'elevation' => array(
74  'type' => 'float',
75  ),
76  'address' => array(
77  'type' => 'text',
78  'length' => 256,
79  'notnull' => false,
80  ),
81  'init_mob_id' => array(
82  'type' => 'integer',
83  'length' => 4,
84  'notnull' => false,
85  ),
86  'comment_mob_id' => array(
87  'type' => 'integer',
88  'length' => 4,
89  ),
90  'container_id' => array(
91  'type' => 'integer',
92  'length' => 4,
93  ),
94  'big_data' => array(
95  'type' => 'clob',
96  ),
97  );
98 
99  return $fields;
100  }
101 
102 
108  public function getInputArray($update_mob_id = false, $blob_null = true, $with_clob = true) {
109  $fields = array(
110  'id' => array(
111  'integer',
112  56,
113  ),
114  'is_online' => array(
115  'integer',
116  true,
117  ),
118  'is_default' => array(
119  'integer',
120  false,
121  ),
122  'latitude' => array(
123  'float',
124  47.059830,
125  ),
126  'longitude' => array(
127  'float',
128  7.624028,
129  ),
130  'elevation' => array(
131  'float',
132  2.56,
133  ),
134  'address' => array(
135  'text',
136  'Farbweg 9, 3400 Burgdorf',
137  ),
138  'init_mob_id' => array(
139  'integer',
140  $update_mob_id ? $update_mob_id : 78,
141  ),
142  'comment_mob_id' => array(
143  'integer',
144  69,
145  ),
146  'container_id' => array(
147  'integer',
148  456,
149  ),
150  );
151  if ($with_clob) {
152  $fields['big_data'] = array(
153  'clob',
154  $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.',
155  );
156  }
157 
158  return $fields;
159  }
160 
161 
165  public function getInputArrayForTransaction() {
166  $fields = array(
167  'id' => array(
168  'integer',
169  123456,
170  ),
171  'is_online' => array(
172  'integer',
173  true,
174  ),
175  'is_default' => array(
176  'integer',
177  false,
178  ),
179  );
180 
181  return $fields;
182  }
183 
184 
189  abstract public function getInsertQuery($table_name);
190 
191 
195  public function getTableCreateSQL($tablename, $engine) {
196  return "CREATE TABLE `" . $tablename . "` (
197  `id` int(11) NOT NULL,
198  `is_online` tinyint(4) DEFAULT NULL,
199  `is_default` tinyint(4) DEFAULT '1',
200  `latitude` double DEFAULT NULL,
201  `longitude` double DEFAULT NULL,
202  `elevation` double DEFAULT NULL,
203  `address` varchar(256) DEFAULT NULL,
204  `init_mob_id` int(11) DEFAULT NULL,
205  `comment_mob_id` int(11) DEFAULT NULL,
206  `container_id` int(11) DEFAULT NULL,
207  `big_data` longtext,
208  PRIMARY KEY (`id`)) ENGINE=$engine DEFAULT CHARSET=utf8";
209  }
210 
211 
215  public function getTableCreateSQLAfterRename($tablename, $engine, $supports_fulltext) {
216  $add_idex = '';
217  if ($supports_fulltext) {
218  $add_idex = ", FULLTEXT KEY `i2_idx` (`address`)";
219  }
220 
221  return "CREATE TABLE `" . $tablename . "` (
222  `id` int(11) NOT NULL,
223  `is_online` tinyint(4) DEFAULT NULL,
224  `is_default` tinyint(4) DEFAULT '1',
225  `latitude` double DEFAULT NULL,
226  `longitude` double DEFAULT NULL,
227  `elevation` double DEFAULT NULL,
228  `address` varchar(256) DEFAULT NULL,
229  `init_mob_id` int(11) DEFAULT NULL,
230  `comment_mob_id_altered` int(11) DEFAULT NULL,
231  `container_id` int(11) DEFAULT NULL,
232  `big_data` longtext,
233  PRIMARY KEY (`id`), KEY `i1_idx` (`init_mob_id`)$add_idex) ENGINE=$engine DEFAULT CHARSET=utf8";
234  }
235 
236 
240  public function getTableCreateSQLAfterAlter($tablename, $engine, $supports_fulltext) {
241  $add_idex = '';
242  if ($supports_fulltext) {
243  $add_idex = ", FULLTEXT KEY `i2_idx` (`address`)";
244  }
245 
246  return "CREATE TABLE `" . $tablename . "` (
247  `id` int(11) NOT NULL,
248  `is_online` tinyint(4) DEFAULT NULL,
249  `is_default` tinyint(4) DEFAULT '1',
250  `latitude` double DEFAULT NULL,
251  `longitude` double DEFAULT NULL,
252  `elevation` double DEFAULT NULL,
253  `address` varchar(256) DEFAULT NULL,
254  `init_mob_id` int(11) DEFAULT NULL,
255  `comment_mob_id_altered` varchar(250) DEFAULT NULL,
256  `container_id` int(11) DEFAULT NULL,
257  `big_data` longtext,
258  PRIMARY KEY (`id`), KEY `i1_idx` (`init_mob_id`)$add_idex) ENGINE=$engine DEFAULT CHARSET=utf8";
259  }
260 }
$engine
Definition: workflow.php:90
getTableCreateSQLAfterAlter($tablename, $engine, $supports_fulltext)
getInputArray($update_mob_id=false, $blob_null=true, $with_clob=true)
Create styles array
The data for the language used.
Class ilDatabaseCommonTestMockData.
getTableCreateSQLAfterRename($tablename, $engine, $supports_fulltext)