Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim sql As SQL
sql.Initialize(File.DirDocuments, "test", True)
Dim cr As ResultSet = sql.ExecQuery("PRAGMA compile_options")
Do While cr.NextRow
Log(cr.GetString2(0))
Loop
sql.ExecNonQuery("DROP TABLE IF EXISTS posts")
sql.ExecNonQuery($"CREATE VIRTUAL TABLE posts
USING FTS5(title, body)"$)
sql.ExecNonQuery($"INSERT INTO posts(title,body)
VALUES('Learn SQlite FTS5','This tutorial teaches you how to perform full-text search in SQLite using FTS5'),
('Advanced SQlite Full-text Search','Show you some advanced techniques in SQLite full-text searching'),
('SQLite Tutorial','Help you learn SQLite quickly and effectively')"$)
Dim rs As ResultSet = sql.ExecQuery($"SELECT *
FROM posts
WHERE posts MATCH 'text'
ORDER BY rank"$)
Do While rs.NextRow
Log(rs.GetString2(0) & ": " & rs.GetString2(1))
Loop
End Sub