jenkins-bot has submitted this change and it was merged.

Change subject: Added long-string handling
......................................................................


Added long-string handling

When long strings in smw_di_blob are displayed, display readable value,
not the value with the hash suffix.

Change-Id: I413a75ebaf3c28cf935aa0afebc25ba241e3473a
---
M includes/SD_Filter.php
M specials/SD_BrowseData.php
2 files changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Yaron Koren: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/SD_Filter.php b/includes/SD_Filter.php
index 580d486..55d1a33 100644
--- a/includes/SD_Filter.php
+++ b/includes/SD_Filter.php
@@ -175,7 +175,7 @@
                                $this->db_value_field = 'o_serialized';
                        } else { // string, text, code
                                $this->db_table_name = 'smw_di_blob';
-                               $this->db_value_field = 'o_hash';
+                               $this->db_value_field = '(CASE WHEN 
octet_length(o_blob) > 1 THEN CONVERT(o_blob using utf8) ELSE o_hash END)';
                        }
                } else {
                        // Things used to be so simple...
diff --git a/specials/SD_BrowseData.php b/specials/SD_BrowseData.php
index a2e64b8..b0c1436 100644
--- a/specials/SD_BrowseData.php
+++ b/specials/SD_BrowseData.php
@@ -361,6 +361,8 @@
                                $sql .= "\n     AND $property_field = (SELECT 
MAX(smw_id) FROM $smwIDs WHERE smw_title = '$property_value' AND smw_namespace 
= $prop_ns) AND ";
                                if ( $af->filter->property_type === 'date' ) {
                                        $value_field = 
"SUBSTRING(a$i.$value_field, 3)";
+                               } elseif (strncmp($value_field, '(CASE WHEN', 
10) == 0) {
+                                       $value_field = str_replace('o_', 
"a$i.o_", $value_field);
                                } else {
                                        $value_field = "a$i.$value_field";
                                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I413a75ebaf3c28cf935aa0afebc25ba241e3473a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticDrilldown
Gerrit-Branch: master
Gerrit-Owner: Jqnatividad <[email protected]>
Gerrit-Reviewer: Jqnatividad <[email protected]>
Gerrit-Reviewer: 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