How to install REGEXP support?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to install REGEXP support?

Peng Yu
Hi,

I'd like to have regexp support in sqlite3.

https://www.sqlite.org/lang_expr.html#regexp

But it is not clear how to install it for sqlite3 installed by
homebrew. Does anybody how to install it? Thanks.

https://stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Jens Alfke-2


> On Sep 16, 2019, at 1:44 PM, Peng Yu <[hidden email]> wrote:
>
> But it is not clear how to install it for sqlite3 installed by
> homebrew. Does anybody how to install it? Thanks.

SQLite doesn't come with a regexp implementation; it has to be added by an extension.
I searched the website; there's a simple implementation here:
        https://www.sqlite.org/src/raw/ext/misc/regexp.c?name=a68d25c659bd2d893cd1215667bbf75ecb9dc7d4 <https://www.sqlite.org/src/raw/ext/misc/regexp.c?name=a68d25c659bd2d893cd1215667bbf75ecb9dc7d4>
And regexp is also available as part of the ICU extension:
        https://www.sqlite.org/src/dir?ci=ee83d8e30d6f9ca8&name=ext/icu <https://www.sqlite.org/src/dir?ci=ee83d8e30d6f9ca8&name=ext/icu>

You're going to have to build these yourself, I think.

—Jens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Peng Yu
Do you know what the commands are to just compile for the regex support?

> SQLite doesn't come with a regexp implementation; it has to be added by an extension.
> I searched the website; there's a simple implementation here:
>         https://www.sqlite.org/src/raw/ext/misc/regexp.c?name=a68d25c659bd2d893cd1215667bbf75ecb9dc7d4 <https://www.sqlite.org/src/raw/ext/misc/regexp.c?name=a68d25c659bd2d893cd1215667bbf75ecb9dc7d4>
> And regexp is also available as part of the ICU extension:
>         https://www.sqlite.org/src/dir?ci=ee83d8e30d6f9ca8&name=ext/icu <https://www.sqlite.org/src/dir?ci=ee83d8e30d6f9ca8&name=ext/icu>
>
> You're going to have to build these yourself, I think.

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Warren Young
On Sep 16, 2019, at 6:24 PM, Peng Yu <[hidden email]> wrote:
>
> Do you know what the commands are to just compile for the regex support?

https://www.sqlite.org/loadext.html
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Peng Yu
gcc -g -fPIC -dynamiclib  regexp.c -o regexp.dylib

I can compile it. Where do I put the .dylib file?

$ cat /usr/local/opt/sqlite/lib/pkgconfig/sqlite3.pc
# Package Information for pkg-config

prefix=/usr/local/Cellar/sqlite/3.29.0
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: SQLite
Description: SQL database engine
Version: 3.29.0
Libs: -L${libdir} -lsqlite3
Libs.private: -lz
Cflags: -I${includedir}

/usr/local/Cellar/sqlite/3.29.0$ find
.
./INSTALL_RECEIPT.json
./bin
./bin/sqlite3
./.brew
./.brew/sqlite.rb
./include
./include/sqlite3.h
./include/sqlite3ext.h
./lib
./lib/libsqlite3.0.dylib
./lib/pkgconfig
./lib/pkgconfig/sqlite3.pc
./lib/libsqlite3.dylib
./lib/libsqlite3.a
./README.txt
./share
./share/man
./share/man/man1
./share/man/man1/sqlite3.1

On Mon, Sep 16, 2019 at 7:58 PM Warren Young <[hidden email]> wrote:

>
> On Sep 16, 2019, at 6:24 PM, Peng Yu <[hidden email]> wrote:
> >
> > Do you know what the commands are to just compile for the regex support?
>
> https://www.sqlite.org/loadext.html
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Jens Alfke-2

> On Sep 17, 2019, at 8:13 AM, Peng Yu <[hidden email]> wrote:
>
> I can compile it. Where do I put the .dylib file?

According to the documentation Warren linked to, you use a SQL statement or shell dot-command to load the extension, giving the path to the library.

—Jens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Peng Yu
But I don't want to always specify a full path. I am asking where is
the standard place to put the library file so that I don't have to
always specify the whole path.

On 9/17/19, Jens Alfke <[hidden email]> wrote:

>
>> On Sep 17, 2019, at 8:13 AM, Peng Yu <[hidden email]> wrote:
>>
>> I can compile it. Where do I put the .dylib file?
>
> According to the documentation Warren linked to, you use a SQL statement or
> shell dot-command to load the extension, giving the path to the library.
>
> —Jens
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Warren Young
On Sep 18, 2019, at 8:33 AM, Peng Yu <[hidden email]> wrote:
>
> But I don't want to always specify a full path. I am asking where is
> the standard place to put the library file so that I don't have to
> always specify the whole path.

You’re verging into “How do I program my computer?” or even “How do I use my computer?” territory here.  Put it in a directory where your OS’s dynamic loader will find it.  For macOS:

   https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW10

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Peng Yu
My question is `But it is not clear how to install it for sqlite3 installed by
homebrew.`

On 9/19/19, Warren Young <[hidden email]> wrote:

> On Sep 18, 2019, at 8:33 AM, Peng Yu <[hidden email]> wrote:
>>
>> But I don't want to always specify a full path. I am asking where is
>> the standard place to put the library file so that I don't have to
>> always specify the whole path.
>
> You’re verging into “How do I program my computer?” or even “How do I use my
> computer?” territory here.  Put it in a directory where your OS’s dynamic
> loader will find it.  For macOS:
>
>
> https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW10
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Keith Medcalf

SELECT LOAD_EXTENSION('regexp');

assuming that the regexp dynamic library is located where it can be found.

>-----Original Message-----
>From: sqlite-users <[hidden email]> On
>Behalf Of Peng Yu
>Sent: Thursday, 19 September, 2019 20:20
>To: SQLite mailing list <[hidden email]>
>Subject: Re: [sqlite] How to install REGEXP support?
>
>My question is `But it is not clear how to install it for sqlite3
>installed by
>homebrew.`
>
>On 9/19/19, Warren Young <[hidden email]> wrote:
>> On Sep 18, 2019, at 8:33 AM, Peng Yu <[hidden email]> wrote:
>>>
>>> But I don't want to always specify a full path. I am asking where is
>>> the standard place to put the library file so that I don't have to
>>> always specify the whole path.
>>
>> You’re verging into “How do I program my computer?” or even “How do I
>use my
>> computer?” territory here.  Put it in a directory where your OS’s
>dynamic
>> loader will find it.  For macOS:
>>
>>
>>
>https://developer.apple.com/library/archive/documentation/DeveloperTools/
>Conceptual/DynamicLibraries/100-
>Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW10
>>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>--
>Regards,
>Peng
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to install REGEXP support?

Jens Alfke-2
In reply to this post by Peng Yu
On Sep 19, 2019, at 7:21 PM, Peng Yu <[hidden email]> wrote:
>
> My question is `But it is not clear how to install it for sqlite3 installed by
> homebrew.`

That sounds more like a question to ask the Homebrew community; it isn’t really related to SQLite directly. SQLite is just making a system call to load a library by name.

—Jens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users