r84747 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84746‎ | r84747 | r84748 >
Date:14:37, 25 March 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
remove DB column for storing units
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -345,9 +345,12 @@
346346 abstract protected function parseUserValue( $value );
347347
348348 /**
349 - * Initialise the datavalue from the given value string and unit.
350 - * The format of both strings strictly corresponds to the output
351 - * of this implementation for getDBkeys().
 349+ * Initialise the datavalue from the given value array.
 350+ * The format of this array corresponds to the output of
 351+ * getDBkeys() but the method might be called with shorter
 352+ * arrays (e.g. if typing information changed since a value
 353+ * was stored). However, there will always be at least one
 354+ * element in the array.
352355 *
353356 * @param array $args
354357 */
@@ -440,7 +443,6 @@
441444 * - l for arbitrarily long strings; searching/sorting with such data may
442445 * be limited for performance reasons,
443446 * - w for strings as used in MediaWiki for encoding interwiki prefixes
444 - * - u for short ("unit") strings; used for units of measurement in SMW
445447 * - n for namespace numbers (or other similar integers)
446448 * - f for floating point numbers of double precision
447449 * - c for the special container format used by SMWContainerValue; if used
@@ -621,7 +623,6 @@
622624 * FALSE if no such version is available. The returned
623625 * string suffices to reobtain the same DataValue
624626 * when passing it as an input string to setUserValue().
625 - * Thus it also includes units, if any.
626627 */
627628 abstract public function getWikiValue();
628629
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -122,8 +122,8 @@
123123 '_wpp' => array( 'tnwt', 3, 3 ), // Property page type
124124 '_wpc' => array( 'tnwt', 3, 3 ), // Category page type
125125 '_wpf' => array( 'tnwt', 3, 3 ), // Form page type (for Semantic Forms)
126 - '_num' => array( 'tfu', 1, 0 ), // Number type
127 - '_tem' => array( 'tfu', 1, 0 ), // Temperature type
 126+ '_num' => array( 'tf', 1, 0 ), // Number type
 127+ '_tem' => array( 'tf', 1, 0 ), // Temperature type
128128 '_dat' => array( 'tf', 1, 0 ), // Time type
129129 '_boo' => array( 't', 0, 0 ), // Boolean type
130130 '_rec' => array( 'tnwt', 0, -1 ),// Value list type (internal object)
@@ -137,7 +137,7 @@
138138 '__spf' => array( 't', 0, 0 ), // Special form type (for Semantic Forms)
139139 '__sin' => array( 'tnwt', 3, 3 ), // Special instance of type
140140 '__red' => array( 'tnwt', 3, 3 ), // Special redirect type
141 - '__lin' => array( 'tfu', 1, 0 ), // Special linear unit conversion type
 141+ '__lin' => array( 'tf', 1, 0 ), // Special linear unit conversion type
142142 '__imp' => array( 't', 0, 0 ), // Special import vocabulary type
143143 '__pro' => array( 't', 0, 0 ), // Property page type; never be stored as a value (_wpp is used there) but needed for sorting
144144 '' => array( 'tlnnn', 0, 0 )
@@ -1262,7 +1262,6 @@
12631263 // Repeatedly used DB field types defined here for convenience.
12641264 $dbtypes = array(
12651265 't' => SMWSQLHelpers::getStandardDBType( 'title' ),
1266 - 'u' => ( $wgDBtype == 'postgres' ? 'TEXT' : 'VARCHAR(63) binary' ),
12671266 'l' => SMWSQLHelpers::getStandardDBType( 'blob' ),
12681267 'f' => ( $wgDBtype == 'postgres' ? 'DOUBLE PRECISION' : 'DOUBLE' ),
12691268 'i' => ( $wgDBtype == 'postgres' ? 'INTEGER' : 'INT(8)' ),
@@ -1749,7 +1748,7 @@
17501749
17511750 if ( $ok ) {
17521751 $result[$i] = $item;
1753 - $sortres[$i] = $value; // we cannot use $value as key: it is not unique if there are units!
 1752+ $sortres[$i] = $value;
17541753 $i++;
17551754 }
17561755 }
@@ -2473,7 +2472,7 @@
24742473
24752474 self::$prop_tables['smw_atts2'] = new SMWSQLStore2Table(
24762475 'smw_atts2',
2477 - array( 'value_xsd' => 't', 'value_num' => 'f', 'value_unit' => 'u' ),
 2476+ array( 'value_xsd' => 't', 'value_num' => 'f' ),
24782477 array( 'value_num', 'value_xsd' )
24792478 );
24802479

Status & tagging log