Hi, i’m trying to implement a full search text using fts5 capabilities.
I’ve read the various tutorials and examples code.
(sorry if i don’t translate the part of the ‘italian’ code)
At the startup of the app i setup my virtual database:
Try
App.DBVirtual.Connect
Catch err as DatabaseException
MessageDialog.Show("Errore: " + err.Message)
Return
End TryTry
App.DBVirtual.ExecuteSQL(“CREATE VIRTUAL TABLE cNotifiche USING fts5(ID, Pratica, Atto, Cronologico, Destinatario, Raccomandata, Giorno, Mese, Anno, Notificato, Duplicato);”)
Catch err As DatabaseException
MessageDialog.Show("Errore DB: " + err.Message)
Return
App.DBVirtual.ExecuteSQL(“INSERT INTO cNotifiche SELECT ID, Pratica, Atto, Cronologico, Destinatario, Raccomandata, Giorno, Mese, Anno, Notificato, Duplicato FROM Notifiche;”)
Catch err As DatabaseException
MessageDialog.Show("Errore DB: " + err.Message)
Return
End Try
First question: if i modify my Notifiche table (in my SQLite ‘real’ database) i should modify accordingly also the virtual one, is it correct ? executing that query, isn’t it ?
App.DBVirtual.ExecuteSQL(“INSERT INTO cNotifiche SELECT ID, Pratica, Atto, Cronologico, Destinatario, Raccomandata, Giorno, Mese, Anno, Notificato, Duplicato FROM Notifiche;”)
When i digit in txt5Cerca.text in its text change event i insert:
If txt5Cerca.text <> “” Then
CercaArchivio
end If
And here’s my method CercaArchivio:
Var rs As RowSet
Var sql As String = “SELECT * FROM cNotifiche WHERE cNotifiche MATCH '” + txt5Cerca.Value + “';”
Try
rs = App.DBVirtual.SelectSQL(sql)
Catch err As DatabaseException
MessageDialog.Show("Errore DB: " + err.Message)
Return
End Try// Loop through each row, one-by-one, and add it to the ListBox.
If rs <> Nil Then
For Each row As DatabaseRow In rs
ListaNotifiche.AddRow(row.Column(“ID”).StringValue, row.Column(“Pratica”).StringValue, row.Column(“Atto”).StringValue, _
row.Column(“Cronologico”).StringValue, row.Column(“Giorno”).StringValue + “/” + row.Column(“Mese”).StringValue + “/” + row.Column(“Anno”).StringValue, row.Column(“Destinatario”).StringValue, row.Column(“Raccomandata”).StringValue), _
row.Column(“Notificato”).StringValue, row.Column(“Duplicato”).StringValue
ListaNotifiche.RowTagAt(ListaNotifiche.LastAddedRowIndex) = row.Column(“ID”).IntegerValue
Nextrs.Close
End If
Do you find some errors in that code ?
My ListaNotifiche not populates at all … stays always totally empty …