SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: sbirrari on October 31, 2018, 04:29:05 am

Title: Messages suppression
Post by: sbirrari on October 31, 2018, 04:29:05 am
Hello,

in my application I'm using two SQLite databases. The library version is 1.60.4.
I would like to suppress every message from SQLitening (errors and lock retries), and handle all the errors in the application.

This is how I open a DB:
- slSetProcessMods "E0 T1000" (to suppress messages while opening the DB)
- slsOpen
- slSetProcessMods "rE0 T1000"
- slPushDatabase

Every time I need to use a DB:
- slPopDatabase
- slsExe/slsSel

I read in the docs that mods are pushed/poped along with the database handle, but one of my customers saw this message
(http://www.sara.pg.it/img/SQLDB.jpg)

How can I completely suppress every error message and let the library calls fail when there is a lock timeout?
Do I need to set the mods on every call?

Thank you,
Riccardo
Title: Re: Messages suppression
Post by: cj on November 01, 2018, 03:28:19 pm
QuoteHow can I completely suppress every error message and let the library calls fail when there is a lock timeout?
Do I need to set the mods on every call?


slSetProcessMods "r" must be after slOpen (which you have done.)
Are you sure you need T1000 (1-second) which causes the problem and no retry?
The default of 10000 (10-seconds) works well so MSGBOX shouldn't appear.

Getting rid of the T option and the pops and pushes would be my suggestion.

Anyway, playing with this code might be useful.


#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
LOCAL hThread AS LONG
slSetProcessMods "E0"

slopen "junk1","CT1000"  'make busy-timeout extremely small (not suggested)
slSetProcessMods "r" 'required after slOpen so busy MSGBOX will not appear

slexe "create table if not exists t1(c1)"
THREAD CREATE LockDataBase(0) TO hThread
THREAD CLOSE hThread to hThread
SLEEP 1000 'so other thread locks before we attempt insert
slexe "insert into t1 values('one')
? "Done"

END FUNCTION

THREAD FUNCTION LockDataBase(BYVAL notused AS LONG) AS LONG
slOpen "junk1"
slExe "begin exclusive"
? "transaction active",,FUNCNAME$
slExe "end"
END FUNCTION