I’m currently trying to implement an app that makes use of the
sqlite3-ruby library. My app requires that I compute soundexes for a lot
of values, and also that I’m able to clean up some names with a basic
gsub-based function. For that I’ve created two very basic functions
called “soundex” and “cleanup_name”. The cleanup-function is pretty much
a one-liner that does a gsub on the value, while the soundex function
calls Text::Soundex.soundex on the value. I run version 1.1.0 of
sqlite3-ruby (MSWIN32), and I’ve installed version 3.3.5 of the
sqlite3.dll. (just to check, I also tried to downgrade to the previous
version of sqlite3-ruby, without any luck)
The problem is that I’m getting an awful lot of segfaults. Sometimes
I’ve been able to get the functions to run on a table or two, only to
fail on another one. I’ve tried to reform my functions in every way I
can think of, including using “.dup”, “.to_s”, “.dup”-ing into an
intermediate variable etc, but I still keep getting the segfaults.
Is there any special way I should handle the arguments to the
create_function block? Should I for instance make a copy of them before
I change them? Should I treat my return values a certain way? The
documentation doesn’t mention anything specific, other than that you
should use result= or set_result() functions on the FunctionProxy to
return the value of the function.
Also, could the problem be that I use the two functions together? I use
them like this: “soundex(cleanup_name(COLUMN)) as COLUMN_SOUNDEX” in the
By putting in a bit of “puts” here and there in the ruby-code in
sqlite3-ruby, I’ve narrowed the problem down to the “step”-function.
It’s called in the native-code, but control is never returned to the
ruby-api before the segfault.
I should probably also mention that I used the sqlite-ruby-api at first,
and then both functions worked without any issues. I’d really like to
use sqlite3 though for the added functionality.