views:

61

answers:

1

I want to do something like: lastName SIMILARTO(lastName, 'Schwarseneger', 2)

where lastName is the field in the database, 'Schwarseneger' is the value that lastName field is being compared to and 2 is the maximum number of characters (edit distance) that can differ between the lastName field, and the entered value.

I can implement the SIMILARTO function in C++ using the Levenshtein distance (http://en.wikipedia.org/wiki/Levenshtein_distance), but how do hook the function in a dll to a mySQL implementation?

+1  A: 

See MySQL 5.1 Reference Manual :: 22.3.2 Adding a New User-Defined Function

This blog post also have detailed instructions for building User Defined Function DLLs on Windows.

Alexandre Jasmin