Add optional MySQLExpression which makes use of mysql's binary keyword #41

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@ldeck

MySQL, by default, uses case insensitive comparisons. So "foo like 'bar'" is the same as "foo like 'BaR'".
WO's case-insensitive like uses the UPPER function which bypasses mysql indexing making it a slow operation.

The solution is to use "foo like 'bar'" for case insensitive and "binary foo like 'Bar'" for case-sensitive.
Similarly for sort orderings, I believe, the binary keyword can be used for case sensitive sort orderings.

Enable with property
com.webobjects.jdbcadaptor.MySQLExpression.enable=true

Note: this is code I was using 16 months ago and hasn't been tested since then. It is optionally enabled and disabled by default. It should be tested before making it the default.

@ldeck ldeck Add optional MySQLExpression which makes use of mysql's binary keyword
MySQL, by default, uses case insensitive comparisons. So "foo like
'bar'" is the same as "foo like 'BaR'". WO's case-insensitive like uses
the UPPER function which bypasses mysql indexing making it a slow
operation. The solution is to use "foo like 'bar'" for case insensitive
and "binary foo like 'Bar'" for case-sensitive. Similarly for sort
orderings, I believe, the binary keyword can be used for case sensitive
sort orderings.  Enable with property
com.webobjects.jdbcadaptor.MySQLExpression.enable=true
5f49fa3
@pascalrobert
WOCommunity Association member

Added to the "integration" branch.

@ldeck

Hey cool! Thanks for merging this in Pascal.

@pascalrobert pascalrobert added a commit that referenced this pull request Mar 5, 2012
@pascalrobert pascalrobert Fix for pull request #41 37ed2f4
@pascalrobert pascalrobert added a commit that referenced this pull request Mar 16, 2012
@pascalrobert pascalrobert Fix for pull request #41 fbb8f36
@getsharp getsharp added a commit to getsharp/wonder that referenced this pull request Mar 29, 2012
@pascalrobert pascalrobert Fix for pull request #41 e9cf7a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment