This demonstrates how multiple global handles are incorrectly created (programming error) for the current database.
Notice the database cannot close correctly or be killed if this is done. Permission denied error.
Calling slOpen many times without closing it will eventually produce an error 7.
Notice the database cannot close correctly or be killed if this is done. Permission denied error.
Calling slOpen many times without closing it will eventually produce an error 7.
Code Select
GLOBAL gs AS STRING
#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
slSetProcessMods "E2"
LOCAL x AS LONG
Logit "Open database only if not open"
FOR x = 1 TO 5
IF ISFALSE(slIsOpen) THEN slopen "junk.tmp","C": Logit USING$("handle #",slGetHandle)
NEXT
slClose
KILL "junk.tmp"
Logit ERROR$(ERR) + " killing junk.tmp"
[b]'Now show how to incorrectly use slOpen[/b]
Logit ""
Logit "Open database without testing if already open"
FOR x = 1 TO 5
slopen "junk.tmp","C"
Logit USING$("handle #",slGetHandle)
NEXT
slClose
KILL "junk.tmp"
LOGIT ERROR$(ERR) + " killing junk.tmp"
? gs
END FUNCTION
SUB LogIt(s AS STRING)
gs = gs + s + $CR
END SUB