SQLite Forum

PCRE as an optionally core extension?

after having been used to [Alexei Tourbin's PCRE extension|http://git.altlinux.org/people/at/packages/?p=sqlite3-pcre.git;a=summary], I was wondering if it could be proposed as a core extension when libpcre is available, implementing the regexp operator (versions < 3.36) or overriding the default one with a speed boost (versions >= 3.36) without the hassle of having to configure it in .sqliterc.

When plugging it in (see below for the results), I was confronted to a loading order between core extensions (e.g. ICU, or PCRE as I did it) and shell.c-defined functions (ext/misc/regexp.c):<br/>
shell.c calls sqlite3_regexp_init() after having opened the database, thus it forcibly overrides any "core extension"-defined function, like regexp.<br/>
I have not tested with ICU, but it seems to me that in this case, ICU's regexp will be used when loaded within libsqlite3, but regexp's one will be used when loaded with sqlite3 command line. Is that intended?

Here is my working POC [https://github.com/outtersg/sqlite/compare/ce7dd3a...a905a9f].<br/>
The two patches with PLACEHOLDER are the hack to allow a core-defined "regexp" not to be overriden by regexp's one in 3.36+; but I am not very satisfied by it.

I would be glad to hear of any other ways to achieve a smooth integration between SQLite and PCRE, or to discuss about the work I have done on it.

-- <br/>
Guillaume, being the billionth glad human to use SQLite on a day-to-day basis