SQLitening Support Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the SQLitening support forums!

Author Topic: Messages suppression  (Read 303 times)

sbirrari

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • SARA electronic instruments
Messages suppression
« on: October 31, 2018, 01:59: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


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
Logged

cj

  • Master Geek
  • ****
  • Posts: 696
    • View Profile
Re: Messages suppression
« Reply #1 on: November 01, 2018, 12:58:19 PM »

Quote
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?

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
Logged
CJ