[SQLITE]ignoring syntax errors during search for sth include "symbols"

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

[SQLITE]ignoring syntax errors during search for sth include "symbols"

Maziar Parsijani
Hi,
how could I ignore syntax errors like this?

> *SELECT *,*
>
> * highlight(searchsimpleenhanced, 2, '<b>', '</b>') text*
>
> * FROM searchsimpleenhanced*
>
> * WHERE searchsimpleenhanced MATCH 'sth][';*
>
there maybe nothing to match but I don't like to get syntax errors for a
symbol or character like([ ] () , . @ ...)
_______________________________________________
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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Bob Gailer
On Oct 18, 2018 5:59 AM, "Maziar Parsijani" <[hidden email]>
wrote:

>
> Hi,
> how could I ignore syntax errors like this?
>
> > *SELECT *,*
> >
> > * highlight(searchsimpleenhanced, 2, '<b>', '</b>') text*
> >
> > * FROM searchsimpleenhanced*
> >
> > * WHERE searchsimpleenhanced MATCH 'sth][';*

As I understand the documentation match must be defined someplace what is
the definition of match in your case? Or what are you trying to accomplish
by using match?
_______________________________________________
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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Maziar Parsijani
hi,
I just search for words an alphabets in different languages with python and
my database is sqlite but I need to do something to not getting error when
user input a wrong character like the ones that I told before.I can ban
user to not input these characters but I am curious to find a way on sqlite.

On Thu, Oct 18, 2018 at 8:25 AM Bob Gailer <[hidden email]> wrote:

> On Oct 18, 2018 5:59 AM, "Maziar Parsijani" <[hidden email]>
> wrote:
> >
> > Hi,
> > how could I ignore syntax errors like this?
> >
> > > *SELECT *,*
> > >
> > > * highlight(searchsimpleenhanced, 2, '<b>', '</b>') text*
> > >
> > > * FROM searchsimpleenhanced*
> > >
> > > * WHERE searchsimpleenhanced MATCH 'sth][';*
>
> As I understand the documentation match must be defined someplace what is
> the definition of match in your case? Or what are you trying to accomplish
> by using match?
> _______________________________________________
> 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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Jens Alfke-2


> On Oct 18, 2018, at 11:17 AM, Maziar Parsijani <[hidden email]> wrote:
>
> I just search for words an alphabets in different languages with python and
> my database is sqlite but I need to do something to not getting error when
> user input a wrong character like the ones that I told before.I can ban
> user to not input these characters but I am curious to find a way on sqlite.

What’s wrong with getting an error? If the error code or message is specific enough, you can detect it and tell the user they’ve entered invalid characters.

—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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Maziar Parsijani
It will crash or exit the program.

On Thu, Oct 18, 2018 at 2:27 PM Jens Alfke <[hidden email]> wrote:

>
>
> > On Oct 18, 2018, at 11:17 AM, Maziar Parsijani <
> [hidden email]> wrote:
> >
> > I just search for words an alphabets in different languages with python
> and
> > my database is sqlite but I need to do something to not getting error
> when
> > user input a wrong character like the ones that I told before.I can ban
> > user to not input these characters but I am curious to find a way on
> sqlite.
>
> What’s wrong with getting an error? If the error code or message is
> specific enough, you can detect it and tell the user they’ve entered
> invalid characters.
>
> —Jens
> _______________________________________________
> 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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Peter da Silva-2
Don't put raw user input where code is expected. Match strongs are code.
You need to encapsulate (eg escape) or filter (delete bad characters) match
strings outside sqlite.

On Thu., 18 Oct. 2018, 13:50 Maziar Parsijani, <[hidden email]>
wrote:

> It will crash or exit the program.
>
> On Thu, Oct 18, 2018 at 2:27 PM Jens Alfke <[hidden email]> wrote:
>
> >
> >
> > > On Oct 18, 2018, at 11:17 AM, Maziar Parsijani <
> > [hidden email]> wrote:
> > >
> > > I just search for words an alphabets in different languages with python
> > and
> > > my database is sqlite but I need to do something to not getting error
> > when
> > > user input a wrong character like the ones that I told before.I can ban
> > > user to not input these characters but I am curious to find a way on
> > sqlite.
> >
> > What’s wrong with getting an error? If the error code or message is
> > specific enough, you can detect it and tell the user they’ve entered
> > invalid characters.
> >
> > —Jens
> > _______________________________________________
> > 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
>
_______________________________________________
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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Jens Alfke-2
In reply to this post by Maziar Parsijani


> On Oct 18, 2018, at 11:50 AM, Maziar Parsijani <[hidden email]> wrote:
>
> It will crash or exit the program.

You’re not handling errors correctly, then. I think you said you’re using Python? Then the query will probably throw a Python exception; you need to catch that and handle it appropriately.

—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: [SQLITE]ignoring syntax errors during search for sth include "symbols"

Dan Kennedy-4
In reply to this post by Maziar Parsijani
On 10/18/2018 04:58 PM, Maziar Parsijani wrote:

> Hi,
> how could I ignore syntax errors like this?
>
>> *SELECT *,*
>>
>> * highlight(searchsimpleenhanced, 2, '<b>', '</b>') text*
>>
>> * FROM searchsimpleenhanced*
>>
>> * WHERE searchsimpleenhanced MATCH 'sth][';*
>>


You can use double quotes to search for a token that contains characters
that are special to FTS5. e.g.

   WHERE col MATCH '"sth]["'

is not a syntax error.

Dan.



> there maybe nothing to match but I don't like to get syntax errors for a
> symbol or character like([ ] () , . @ ...)
> _______________________________________________
> 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