Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/305246

Change subject: Autocompletion fixes for PostgreSQL
......................................................................

Autocompletion fixes for PostgreSQL

Change-Id: I3db300e8b057d5163ff84677326ab46f0e237080
---
M includes/SF_ValuesUtils.php
1 file changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/46/305246/2

diff --git a/includes/SF_ValuesUtils.php b/includes/SF_ValuesUtils.php
index 7f2ccd1..2bc88da 100644
--- a/includes/SF_ValuesUtils.php
+++ b/includes/SF_ValuesUtils.php
@@ -403,11 +403,19 @@
        * @author Yaron Koren
        */
        public static function getSQLConditionForAutocompleteInColumn( $column, 
$substring, $replaceSpaces = true ) {
-               global $sfgAutocompleteOnAllChars;
+               global $wgDBtype, $sfgAutocompleteOnAllChars;
 
-               $column_value = "LOWER(CONVERT($column USING utf8))";
+               // CONVERT() is also supported in PostgreSQL, but it doesn't
+               // seem to work the same way.
+               if ( $wgDBtype == 'mysql' ) {
+                       $column_value = "LOWER(CONVERT($column USING utf8))";
+               } else {
+                       $column_value = "LOWER($column)";
+               }
+
+               $substring = strtolower( $substring );
                if ( $replaceSpaces ) {
-                       $substring = str_replace( ' ', '_', strtolower( 
$substring ) );
+                       $substring = str_replace( ' ', '_', $substring );
                }
                $substring = str_replace( "'", "\'", $substring );
                $substring = str_replace( '_', '\_', $substring );

-- 
To view, visit https://gerrit.wikimedia.org/r/305246
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3db300e8b057d5163ff84677326ab46f0e237080
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to