digital-fabric/extralite

Sequel adapter can't be used with setup_regexp_function: true

paddor opened this issue · 2 comments

A regexp function (for the REGEXP SQL operator) can't be created because Extralite::Database#create_function is missing:

Sequel::DatabaseConnectionError: NoMethodError: undefined method `create_function' for #<Extralite::Database:0x00007f5d00ae4098 :memory:>

PR #56 also depends on this.

This is definitely a WONTFIX. Due to performance and concurrency concern, Extralite does not support calling back into Ruby code while running SQLite queries. This means that you cannot define functions, aggregations, collations etc in Ruby. If you wish to do so, you'll have to use the sqlite3-ruby gem.

FWIW, the sqlean collection of SQLite extensions includes a regexp extension that works great, is fast, and provides multiple functions for working with regexps.

No problem. But in that case I suggest removing at least these lines: https://github.com/digital-fabric/extralite/blob/main/lib/sequel/adapters/extralite.rb#L127-L131

Personally I don't use this gem yet. Given the recent improvements in Sequel regarding Regexp caching (shameless plug) I just wanted to ensure drop-in compatibility with this gem.