Posted by Kelvin on 13 Apr 2011 at 03:18 pm | Tagged as: programming
Update: Changed 0x00 to '\0' as per Jan-Hendrik's comment below.
There are a number of MySQL functions for calculating Levenshtein distance floating around StackOverflow and other forums. They all seem to be based off http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/ (broken link).
Anyway, I couldn't get them to work for me. MySQL complained:
Well, it turns out that you need to specify a delimiter instead of the default delimiter of ;. So here's a working version of the levenstein distance function, courtesy of CodeJanitor.