Hi Yaron,
On 2009-04-22 08:28, Yaron Koren wrote:
> Version 1.6 of Semantic Forms has been released. This is a fairly major
> new version, with a lot of additions and bug fixes. They are:
[...]
Thanks for all the work you put into SF :)
I found and fixed another problem with autocompletion - a patch is attached.
The problem was that MySQL's LOWER() [1] does not work on BINARY, VARBINARY and
BLOB. But `page_title` is (now?) of type VARBINARY. I changed the SQL queries
so that all arguments to LOWER() function calls are converted to UTF8 first.
Patrick.
[1]: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_lower
--
Key ID: 0x86E346D4 http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Semantic Forms" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/semantic-forms?hl=en
-~----------~----~----~----~------~----~------~--~---
diff -Nur SemanticForms.original/includes/SF_AutocompleteAPI.php SemanticForms/includes/SF_AutocompleteAPI.php
--- SemanticForms.original/includes/SF_AutocompleteAPI.php 2009-03-30 12:06:17.000000000 +0000
+++ SemanticForms/includes/SF_AutocompleteAPI.php 2009-04-22 06:33:42.000000000 +0000
@@ -137,7 +137,7 @@
$substring = str_replace(' ', '_', strtolower($substring));
$substring = str_replace('_', '\_', $substring);
$substring = str_replace("'", "\'", $substring);
- $conditions .= " AND (LOWER($value_field) LIKE '" . $substring . "%' OR LOWER($value_field) LIKE '%\_" . $substring . "%')";
+ $conditions .= " AND (LOWER(CONVERT(`$value_field` USING utf8)) LIKE '" . $substring . "%' OR LOWER(CONVERT(`$value_field` USING utf8)) LIKE '%\_" . $substring . "%')";
}
$sql_options['ORDER BY'] = $value_field;
$res = $db->select( $from_clause,
diff -Nur SemanticForms.original/includes/SF_Utils.inc SemanticForms/includes/SF_Utils.inc
--- SemanticForms.original/includes/SF_Utils.inc 2009-04-04 01:35:13.000000000 +0000
+++ SemanticForms/includes/SF_Utils.inc 2009-04-22 06:37:55.000000000 +0000
@@ -244,7 +244,7 @@
$substring = str_replace(' ', '_', strtolower($substring));
$substring = str_replace('_', '\_', $substring);
$substring = str_replace("'", "\'", $substring);
- $conditions = 'cl_to = '. $db->addQuotes($category) . " AND (LOWER(page_title) LIKE '" . $substring . "%' OR LOWER(page_title) LIKE '%\_" . $substring . "%' OR page_namespace = " . NS_CATEGORY . ")";
+ $conditions = 'cl_to = '. $db->addQuotes($category) . " AND (LOWER(CONVERT(`page_title` USING utf8)) LIKE '" . $substring . "%' OR LOWER(CONVERT(`page_title` USING utf8)) LIKE '%\_" . $substring . "%' OR page_namespace = " . NS_CATEGORY . ")";
} else {
$conditions = 'cl_to = '. $db->addQuotes($category);
}
@@ -334,7 +334,7 @@
$substring = str_replace(' ', '_', strtolower($substring));
$substring = str_replace('_', '\_', $substring);
$substring = str_replace("'", "\'", $substring);
- $conditions .= " AND (LOWER(page_title) LIKE '$substring%' OR LOWER(page_title) LIKE '%\_$substring%')";
+ $conditions .= " AND (LOWER(CONVERT(`page_title` USING utf8)) LIKE '$substring%' OR LOWER(CONVERT(`page_title` USING utf8)) LIKE '%\_$substring%')";
}
$sql_options['ORDER BY'] = 'page_title';
$res = $db->select( $db->tableNames('page'),