Query with """" not works

Why this query (on FTS4 SQLite table):

rs = DB.SelectSQL(“SELECT * FROM cNotifiche WHERE cNotifiche MATCH ?”, “”""+txt5Cerca.text+"""")

works properly while this other one with * not ?

rs = DB.SelectSQL(“SELECT * FROM cNotifiche WHERE cNotifiche MATCH ?”, “”""+txt5Cerca.text+"""" + “*” )

in DBBrowser for SQLite this query works:

SELECT * FROM cNotifiche WHERE cNotifiche MATCH ‘fa*’

(i’ve inserted NO curly brakes don’t know why when copy/past code here in forum the curly brakes where added instead of straight ones used)

Xojo should automatic insert your text parameter between quotation marks if it is type string.
DB.SelectSQL(“SELECT * FROM cNotifiche WHERE cNotifiche MATCH ?”, txt5Cerca.text + "%")

1 Like

Mostly correct Markus. Yes, when using SelectSQL, you do not need to do the quoting, but the wildcard character is not % in a full text search, it’s a *.

2 Likes

About quoting, In SQLITE use just 2 chars for delimiters:

and "

’ is used for literal strings like

SELECT * WHERE my_field = ’ This String’

" is used for naming identifiers as

SELECT id, “my crazy field name with spaces” WHERE “my other field” = ’ This String’

Almost correct, you need quoting if you are looking for text with apostrophe and you haven’t changed the tokeniser in order to include them.