It’s now the second time I got information from a user where connecting to an SQLDatabaseMBS makes a very odd OutOfBoundsException. Session log info:
2020-11-18 12:40:13 --------------------------
2020-11-18 12:40:13 An error happened:
2020-11-18 12:40:13 Class/Method: SQLiteIndex.Write
2020-11-18 12:40:13 Time: Wednesday, 18 November 2020 12:40:13 pm Australian Eastern Standard Time 326331
2020-11-18 12:40:13 Type of Error: OutOfBoundsException
2020-11-18 12:40:13 --------------------------
2020-11-18 12:40:13 Stack:
2020-11-18 12:40:13
Function ErrorException.ParseParams(string) as string()
Function ErrorException.CleanMangledFunction(string) as string
Function ErrorException.CleanStack(RuntimeException) as string
Sub ErrorException.Constructor(RuntimeException, string)
Function SQLiteIndex.ConnectToDatabaseLocalMBS() as boolean
Sub SQLiteIndex.Write(int64, string)
Function MailParser.parse() as int64
Sub ArchiveThread.Archive()
Sub ArchiveThread.Event_Run()
SQLiteIndex.Write:
call ConnectToDatabaseLocalMBS
if not ConnectedToSQLite then Return
WriteLocalMBS(theRecID, MessageBody)
CloseSQLite
exception exc
theException = new ErrorException(exc, currentMethodName)
ConnectToDatabaseLocalMBS:
dim NeedToCreateIndex as Boolean
if OriginalDB = Nil then Return False
if OriginalFolderitem = nil then Return False
dim OriginalName as String = OriginalFolderitem.NameWithoutExtensionMBS
dim DBIndex as FolderItem = OriginalFolderitem.Parent.Child(OriginalName + "." + FileTypes.Index.Extensions)
if not DBIndex.Exists then NeedToCreateIndex = True
SQLiteIndexDBMBS = New SQLDatabaseMBS
SQLiteIndexDBMBS.DatabaseName = "sqlite:" + DBIndex.UnixpathMBS
SQLiteIndexDBMBS.AutoCommit = SQLDatabaseMBS.kAutoCommitOn
'connect
if SQLiteIndexDBMBS.Connect then
ConnectedToSQLite = True
else
globals.theErrorLog.LogItem CurrentMethodName + " connect"
globals.theErrorLog.DialogErrorProceed(kErrorConnectLocal + " " + SQLiteIndexDBMBS.ErrorMessage)
ConnectedToSQLite = False
Return False
end if
if NeedToCreateIndex then
ConnectedToSQLite = CreateDatabaseLocalMBS
end if
if ConnectedToSQLite then
dim theConnection as SQLConnectionMBS = SQLiteIndexDBMBS.Connection
theConnection.SQLiteEnableLoadExtension(true)
dim errorMessage as string
dim file as FolderItem = TPSF.Frameworks.Child("libicu.dylib") // an extension as FolderItem or path
#Pragma Unused file
if errorMessage <> "" then
ConnectedToSQLite = False
end if
end if
if ConnectedToSQLite then
SQLiteIndexDBMBS.ExecuteSQL "PRAGMA cache_size = 500000" // 500 MB
SQLiteIndexDBMBS.ExecuteSQL "PRAGMA encoding = ""UTF-8""" // encoding utf8 instead of utf16
end if
return NeedToCreateIndex
exception exc
theException = new ErrorException(exc, currentMethodName)
There is nothing at all in the code that could make an OutOfBoundsException? Everything works in a thread. But there is only one thread with the database code.
@Christian_Schmitz: Do you have an idea what might cause the exception?