r67483 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67482‎ | r67483 | r67484 >
Date:22:49, 6 June 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed like comparator regression
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php
@@ -754,15 +754,21 @@
755755 $where = $customSQL;
756756 }
757757 else {
 758+ $value = $keys[$valueIndex];
 759+
758760 switch ( $description->getComparator() ) {
759761 case SMW_CMP_EQ: $comparator = '='; break;
760762 case SMW_CMP_LEQ: $comparator = '<='; break;
761763 case SMW_CMP_GEQ: $comparator = '>='; break;
762764 case SMW_CMP_NEQ: $comparator = '!='; break;
 765+ case SMW_CMP_LIKE: case SMW_CMP_NLKE:
 766+ $comparator = ' LIKE ';
 767+ if ( $description->getComparator() == SMW_CMP_NLKE ) $comparator = " NOT{$comparator}";
 768+ $value = str_replace( array( '%', '_', '*', '?' ), array( '\%', '\_', '%', '_' ), $value );
763769 }
764770
765771 if ( $comparator ) {
766 - $where = "$query->alias.{$fieldName}{$comparator}" . $this->m_dbs->addQuotes( $keys[$valueIndex] );
 772+ $where = "$query->alias.{$fieldName}{$comparator}" . $this->m_dbs->addQuotes( $value );
767773 }
768774 }
769775 }

Status & tagging log