Re: [sqlite] OR statement in LIKE

2018-05-10 Thread Keith Medcalf

You could probably use the one in Sqlite3 as well, rather than a third party 
one ...

https://www.sqlite.org/src/artifact/a68d25c659bd2d89


---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Jens Alfke
>Sent: Thursday, 10 May, 2018 12:54
>To: SQLite mailing list
>Subject: Re: [sqlite] OR statement in LIKE
>
>
>
>> On May 10, 2018, at 10:27 AM, Stephen Chrzanowski
> wrote:
>>
>> select * from SomeComments where Comment like 'Beginning%|%End'
>
>
>Don’t try to reinvent regular expressions! If you add a SQLite
>extension that defines a regexp() function, such as this one (which
>I’ve never used)
>   https://github.com/eatnumber1/sqlite-regexp
><https://github.com/eatnumber1/sqlite-regexp>
>then you can write that query as:
>   select * from SomeComments where Comment regexp
>'(^Beginning)|(End$)'
>(Apologies if I’m misremembering my regex syntax!)
>
>—Jens
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] OR statement in LIKE

2018-05-10 Thread Jens Alfke


> On May 10, 2018, at 10:27 AM, Stephen Chrzanowski  wrote:
> 
> select * from SomeComments where Comment like 'Beginning%|%End'


Don’t try to reinvent regular expressions! If you add a SQLite extension that 
defines a regexp() function, such as this one (which I’ve never used)
https://github.com/eatnumber1/sqlite-regexp 

then you can write that query as:
select * from SomeComments where Comment regexp '(^Beginning)|(End$)'
(Apologies if I’m misremembering my regex syntax!)

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] OR statement in LIKE

2018-05-10 Thread Dennis Clarke

On 05/10/2018 01:48 PM, David Raymond wrote:

Insert usual comment of "the more you add, the less 'Lite' it becomes"




Saw this and thought "brilliant".
Exactly.

The UNIX way is to do one thing and do it well and move on.
Not seventy five things poorly.


Dennis
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] OR statement in LIKE

2018-05-10 Thread David Raymond
Insert usual comment of "the more you add, the less 'Lite' it becomes"

Rather than changing LIKE, which would probably be bad, adding in something 
akin to Postgres's SIMILAR TO is a better idea.

https://www.postgresql.org/docs/10/static/functions-matching.html

I'd be of the opinion that going past that to full regular expression support 
is best left to extensions rather than the base SQLite.


SELECT * FROM SomeComments WHERE Comment IS SOMETHING ALONG THE LINES OF 
'Beginning%|%End';


-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Stephen Chrzanowski
Sent: Thursday, May 10, 2018 1:28 PM
To: General Discussion of SQLite Database
Subject: [sqlite] OR statement in LIKE

I can't remember if I asked this before.  Went to google and didn't find an
answer.

Could there be a plan put in place that would including an "OR" mask
character?

The reason I ask is that I've got a user input field that searches the
required field in a database using % as the "AND" statement, but, I'd like
to expand to include using "OR" as well, but, not have to rely on my
software to regenerate a SQL statement with multiple [Field LIKE
'%UserInput%"] statements.

I'd expect the LIKE to work the same as the % mask works now, in that each
OR statement is queried against the position of that mask.  So

select * from SomeComments where Comment like 'Beginning%|%End'

would return results where the SomeComments field begins with "Beginning"
or ends with "End".
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users