r53686 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53685‎ | r53686 | r53687 >
Date:17:57, 23 July 2009
Author:yaron
Status:deferred
Tags:
Comment:
Added Patrick Nagel's fix of SQL for binary-storage databases
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php
@@ -127,10 +127,10 @@
128128 $property_name = str_replace(' ', '_', $property_name);
129129 $conditions = "p_ids.smw_title = '$property_name'";
130130 if ($substring != null) {
131 - $substring = str_replace(' ', '_', strtolower($substring));
132 - $substring = str_replace('_', '\_', $substring);
133 - $substring = str_replace("'", "\'", $substring);
134 - $conditions .= " AND (LOWER(CONVERT($value_field USING utf8)) LIKE '" . $substring . "%' OR LOWER(CONVERT($value_field USING utf8)) LIKE '%\_" . $substring . "%')";
 131+ $substring = str_replace("'", "\'", strtolower($substring));
 132+ // utf8 conversion is needed in case MediaWiki is using
 133+ // binary data storage
 134+ $conditions .= " AND (REPLACE(LOWER(CONVERT($value_field USING utf8)),'_',' ') LIKE '" . $substring . "%' OR REPLACE(LOWER(CONVERT($value_field USING utf8)),'_',' ') LIKE '% " . $substring . "%')";
135135 }
136136 $sql_options['ORDER BY'] = $value_field;
137137 $res = $db->select( $from_clause,

Status & tagging log