r23899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23898‎ | r23899 | r23900 >
Date:12:23, 9 July 2007
Author:proes
Status:old
Tags:
Comment:
Key columns now really are columns instead of strings
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php
@@ -46,14 +46,13 @@
4747 class Table {
4848 public $identifier;
4949 public $isVersioned;
50 - public $keyFields;
 50+ public $keyColumns;
5151 public $columns;
5252
53 - public function __construct($identifier, $isVersioned, $keyFields) {
 53+ public function __construct($identifier, $isVersioned) {
5454 # Without dataset prefix!
5555 $this->identifier = $identifier;
5656 $this->isVersioned = $isVersioned;
57 - $this->keyFields = $keyFields;
5857 $this->columns = array();
5958 }
6059
@@ -68,14 +67,18 @@
6968
7069 return $result;
7170 }
 71+
 72+ protected function setKeyColumns(array $keyColumns) {
 73+ $this->keyColumns = $keyColumns;
 74+ }
7275 }
7376
7477 class VersionedTable extends Table {
7578 public $addTransactionId;
7679 public $removeTransactionId;
7780
78 - public function __construct($identifier, $keyFields) {
79 - parent::__construct($identifier, true, $keyFields);
 81+ public function __construct($identifier) {
 82+ parent::__construct($identifier, true);
8083
8184 $this->addTransactionId = $this->createColumn("add_transaction_id");
8285 $this->removeTransactionId = $this->createColumn("remove_transaction_id");
@@ -87,10 +90,12 @@
8891 public $definedMeaningId;
8992
9093 public function __construct($identifier) {
91 - parent::__construct($identifier, false, array("name"));
 94+ parent::__construct($identifier, false);
9295
9396 $this->name = $this->createColumn("name");
9497 $this->definedMeaningId = $this->createColumn("defined_meaning_id");
 98+
 99+ $this->setKeyColumns(array($this->name));
95100 }
96101 }
97102
@@ -102,13 +107,15 @@
103108 public $comment;
104109
105110 public function __construct($identifier) {
106 - parent::__construct($identifier, false, array("transaction_id"));
 111+ parent::__construct($identifier, false);
107112
108113 $this->transactionId = $this->createColumn("transaction_id");
109114 $this->userId = $this->createColumn("user_id");
110115 $this->userIp = $this->createColumn("user_ip");
111116 $this->timestamp = $this->createColumn("timestamp");
112117 $this->comment = $this->createColumn("comment");
 118+
 119+ $this->setKeyColumns(array($this->transactionId));
113120 }
114121 }
115122
@@ -118,11 +125,13 @@
119126 public $meaningTextTcid;
120127
121128 public function __construct($identifier) {
122 - parent::__construct($identifier, array("defined_meaning_id"));
 129+ parent::__construct($identifier);
123130
124131 $this->definedMeaningId = $this->createColumn("defined_meaning_id");
125132 $this->expressionId = $this->createColumn("expression_id");
126133 $this->meaningTextTcid = $this->createColumn("meaning_text_tcid");
 134+
 135+ $this->setKeyColumns(array($this->definedMeaningId));
127136 }
128137 }
129138
@@ -132,11 +141,13 @@
133142 public $sourceId;
134143
135144 public function __construct($identifier) {
136 - parent::__construct($identifier, array("meaning_mid", "meaning_text_tcid"));
 145+ parent::__construct($identifier);
137146
138147 $this->meaningMid = $this->createColumn("meaning_mid");
139148 $this->meaningTextTcid = $this->createColumn("meaning_text_tcid");
140149 $this->sourceId = $this->createColumn("source_id");
 150+
 151+ $this->setKeyColumns(array($this->meaningMid, $this->meaningTextTcid));
141152 }
142153 }
143154
@@ -147,12 +158,14 @@
148159 public $languageId;
149160
150161 public function __construct($name) {
151 - parent::__construct($name, array("expression_id"));
 162+ parent::__construct($name);
152163
153164 $this->expressionId = $this->createColumn("expression_id");
154165 $this->spelling = $this->createColumn("spelling");
155166 $this->hyphenation = $this->createColumn("hyphenation");
156167 $this->languageId = $this->createColumn("language_id");
 168+
 169+ $this->setKeyColumns(array($this->expressionId));
157170 }
158171 }
159172
@@ -164,13 +177,15 @@
165178 public $attributeType;
166179
167180 public function __construct($name) {
168 - parent::__construct($name, array("object_id"));
 181+ parent::__construct($name);
169182
170183 $this->objectId = $this->createColumn("object_id");
171184 $this->classMid = $this->createColumn("class_mid");
172185 $this->levelMid = $this->createColumn("level_mid");
173186 $this->attributeMid = $this->createColumn("attribute_mid");
174 - $this->attributeType = $this->createColumn("attribute_type");
 187+ $this->attributeType = $this->createColumn("attribute_type");
 188+
 189+ $this->setKeyColumns(array($this->objectId));
175190 }
176191 }
177192
@@ -180,11 +195,13 @@
181196 public $classMemberMid;
182197
183198 public function __construct($name) {
184 - parent::__construct($name, array("class_membership_id"));
 199+ parent::__construct($name);
185200
186201 $this->classMembershipId = $this->createColumn("class_membership_id");
187202 $this->classMid = $this->createColumn("class_mid");
188203 $this->classMemberMid = $this->createColumn("class_member_mid");
 204+
 205+ $this->setKeyColumns(array($this->classMembershipId));
189206 }
190207 }
191208
@@ -195,12 +212,14 @@
196213 public $applicableLanguageId;
197214
198215 public function __construct($name) {
199 - parent::__construct($name, array('collection_id', 'member_mid'));
 216+ parent::__construct($name);
200217
201218 $this->collectionId = $this->createColumn("collection_id");
202219 $this->memberMid = $this->createColumn("member_mid");
203220 $this->internalMemberId = $this->createColumn("internal_member_id");
204221 $this->applicableLanguageId = $this->createColumn("applicable_language_id");
 222+
 223+ $this->setKeyColumns(array($this->collectionId, $this->memberMid));
205224 }
206225 }
207226
@@ -211,12 +230,14 @@
212231 public $relationTypeMid;
213232
214233 public function __construct($name) {
215 - parent::__construct($name, array("relation_id"));
 234+ parent::__construct($name);
216235
217236 $this->relationId = $this->createColumn("relation_id");
218237 $this->meaning1Mid = $this->createColumn("meaning1_mid");
219238 $this->meaning2Mid = $this->createColumn("meaning2_mid");
220239 $this->relationTypeMid = $this->createColumn("relationtype_mid");
 240+
 241+ $this->setKeyColumns(array($this->relationId));
221242 }
222243 }
223244
@@ -228,13 +249,15 @@
229250 public $identicalMeaning;
230251
231252 public function __construct($name) {
232 - parent::__construct($name, array("syntrans_sid"));
 253+ parent::__construct($name);
233254
234255 $this->syntransSid = $this->createColumn("syntrans_sid");
235256 $this->definedMeaningId = $this->createColumn("defined_meaning_id");
236257 $this->expressionId = $this->createColumn("expression_id");
237258 $this->firstUse = $this->createColumn("firstuse");
238259 $this->identicalMeaning = $this->createColumn("identical_meaning");
 260+
 261+ $this->setKeyColumns(array($this->syntransSid));
239262 }
240263 }
241264
@@ -245,12 +268,14 @@
246269 public $text;
247270
248271 public function __construct($name) {
249 - parent::__construct($name, array("value_id"));
 272+ parent::__construct($name);
250273
251274 $this->valueId = $this->createColumn("value_id");
252275 $this->objectId = $this->createColumn("object_id");
253276 $this->attributeMid = $this->createColumn("attribute_mid");
254277 $this->text = $this->createColumn("text");
 278+
 279+ $this->setKeyColumns(array($this->valueId));
255280 }
256281 }
257282
@@ -261,12 +286,14 @@
262287 public $valueTcid;
263288
264289 public function __construct($name) {
265 - parent::__construct($name, array("value_id"));
 290+ parent::__construct($name);
266291
267292 $this->valueId = $this->createColumn("value_id");
268293 $this->objectId = $this->createColumn("object_id");
269294 $this->attributeMid = $this->createColumn("attribute_mid");
270295 $this->valueTcid = $this->createColumn("value_tcid");
 296+
 297+ $this->setKeyColumns(array($this->valueId));
271298 }
272299 }
273300
@@ -278,13 +305,15 @@
279306 public $originalLanguageId;
280307
281308 public function __construct($name) {
282 - parent::__construct($name, array("translated_content_id", "language_id"));
 309+ parent::__construct($name);
283310
284311 $this->translatedContentId = $this->createColumn("translated_content_id");
285312 $this->languageId = $this->createColumn("language_id");
286313 $this->shortTextId = $this->createColumn("shorttext_id");
287314 $this->textId = $this->createColumn("text_id");
288315 $this->originalLanguageId = $this->createColumn("original_language_id");
 316+
 317+ $this->setKeyColumns(array($this->translatedContentId, $this->languageId));
289318 }
290319 }
291320
@@ -295,12 +324,14 @@
296325 public $languageId;
297326
298327 public function __construct($name) {
299 - parent::__construct($name, array("attribute_id", "option_mid"));
 328+ parent::__construct($name);
300329
301330 $this->optionId = $this->createColumn("option_id");
302331 $this->attributeId = $this->createColumn("attribute_id");
303332 $this->optionMid = $this->createColumn("option_mid");
304333 $this->languageId = $this->createColumn("language_id");
 334+
 335+ $this->setKeyColumns(array($this->attributeId, $this->optionMid)); // TODO: is this the correct key?
305336 }
306337 }
307338
@@ -310,11 +341,13 @@
311342 public $optionId;
312343
313344 public function __construct($name) {
314 - parent::__construct($name, array("value_id"));
 345+ parent::__construct($name);
315346
316347 $this->valueId = $this->createColumn("value_id");
317348 $this->objectId = $this->createColumn("object_id");
318349 $this->optionId = $this->createColumn("option_id");
 350+
 351+ $this->setKeyColumns(array($this->valueId));
319352 }
320353 }
321354
@@ -326,13 +359,15 @@
327360 public $label;
328361
329362 public function __construct($name) {
330 - parent::__construct($name, array("value_id"));
 363+ parent::__construct($name);
331364
332365 $this->valueId = $this->createColumn("value_id");
333366 $this->objectId = $this->createColumn("object_id");
334367 $this->attributeMid = $this->createColumn("attribute_mid");
335368 $this->url = $this->createColumn("url");
336369 $this->label = $this->createColumn("label");
 370+
 371+ $this->setKeyColumns(array($this->valueId));
337372 }
338373 }
339374

Status & tagging log