r54202 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54201‎ | r54202 | r54203 >
Date:12:30, 2 August 2009
Author:mkroetzsch
Status:deferred
Tags:
Comment:
support proper numeric sorting even if no datavalue boundary is given in call of getPropertyValues()
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -385,11 +385,11 @@
386386 $db->freeResult($res);
387387 break;
388388 case SMW_SQL2_ATTS2:
389 - if ( ($requestoptions !== NULL) && ($requestoptions->boundary !== NULL) &&
390 - ($requestoptions->boundary->isNumeric()) ) {
391 - $value_column = 'value_num';
392 - } else {
393 - $value_column = 'value_xsd';
 389+ if ( ($requestoptions !== NULL) && ($requestoptions->boundary !== NULL) ) { // the quick way to find out if this is a numeric type
 390+ $value_column = $requestoptions->boundary->isNumeric()?'value_num':'value_xsd';
 391+ } else { // need to do more work to find out if this is a numeric type
 392+ $testval = SMWDatavalueFactory::newTypeIDValue($property->getPropertyTypeID());
 393+ $value_column = $testval->isNumeric()?'value_num':'value_xsd';
394394 }
395395 $sql = 'p_id=' . $db->addQuotes($pid) .
396396 $this->getSQLConditions($requestoptions,$value_column,'value_xsd');

Status & tagging log