1. Beatrix Willius
  2. as SQLite DB Server
  3. Пятница, Июнь 12 2020, 08:44 AM
  4.  Подписаться через email
How do I write to VSQLite? I must be missing something simple - again.

For the database with the table

CREATE VIRTUAL TABLE if not exists bodyindex USING fts4(tokenize=unicode61,content='', messagebody);

the following code to add data works:


dim theRecid as Integer = 11
dim thePreparedStatement as SqlitePreparedStatement = db.Prepare("INSERT INTO bodyindex(docid, messagebody) VALUES(" + str(theRecID) + ", ?)")
thePreparedStatement.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
dim messagebody as String = exampleTextFile
thePreparedStatement.SQLExecute(MessageBody)
thePreparedStatement = Nil


After writing I can see that the SQLite database now is much larger.

If I do something similar for my app


try
dim thePreparedStatement as VSqlitePreparedStatement = remote_db.PrepareEx("INSERT INTO bodyindex(docid, messagebody) VALUES(" + str(theRecID) + ", ?)")
thePreparedStatement.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
if MessageBody = "" then
thePreparedStatement.SQLExecute(App.MailFields.MessageBody)
else
thePreparedStatement.SQLExecute(MessageBody)
end if
thePreparedStatement = Nil

catch err as DatabaseException
Globals.theErrorLog.DialogErrorProceed kErrorWrite + " " + err.Message
globals.StopArchiving = True
end try


I can see the wal and shm files. A tiny little bit seems to be written because the database is now 100kb. Due to the nature of the database I can't easily check the content. But searching doesn't work. I tripple checked that the data that should be written is correct.

I also tried to do "begin transaction/commit transaction". But this just gives me the error:

Sqlite db "mail archive.sqlite": Error : "cannot commit - no transaction is active".

What am I doing wrong?

Valentina 10.4.something on High Sierra.
Комментарий
There are no comments made yet.
Beatrix Willius Ответ принят
I must be doing something very stupid :( .
Комментарий
There are no comments made yet.
  • Страница :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.