Hello there,
I'm doing some experiments with SQLite DB using FTS. Given the code below, I am getting an error "unhandled exception: no such module: fts3 [DbError]"
Does db_sqlite can handle the SQLite's FTS feature ? If so, pls, how can I do that ? Thx in advance, Alfred N.
import db_sqlite, math
let theDbFTS = open("mytestFTS.sqlite", nil, nil, nil)
theDbFTS.exec(sql"Drop table if exists mail")
theDbFTS.exec(sql("""
CREATE VIRTUAL TABLE mail USING fts3(
subject VARCHAR(256) NOT NULL,
body TEXT CHECK(length(body)<10240)
)"""))
theDbFTS.exec(sql"BEGIN")
for i in 1..10:
theDb.exec(sql"INSERT INTO mail (subject, body) VALUES (?,?)", $i, "body" & $i)
theDb.exec(sql"COMMIT")
theDbFTS.close()
Error: unhandled exception: no such module: fts3 [DbError]
Solved: I just copied the latest SQlite 32 & 64 bit DLLs to nimbin folder (and renamed them to sqlite3_32.dll and sqlite3_64.dll). The native Nim package is using dated DLLs.
BTW, there are typos in my former code. The correct is the following:
import db_sqlite, math
let theDbFTS = open("mytestFTS2.sqlite", nil, nil, nil)
theDbFTS.exec(sql"Drop table if exists mail")
theDbFTS.exec(sql("""
CREATE VIRTUAL TABLE mail USING fts3(
subject VARCHAR(256) NOT NULL,
body TEXT CHECK(length(body)<10240)
)"""))
theDbFTS.exec(sql"BEGIN")
for i in 1..10:
theDbFTS.exec(sql"INSERT INTO mail (subject, body) VALUES (?,?)", $i, "body" & $i)
theDbFTS.exec(sql"COMMIT")
theDbFTS.close()
Cheers, Alfred N