Using this code to write large .csv file to SQLite:
Using this on a large file (377887 rows) I get an app crash without any information (also looked at the unfiltered logs).
The other problem that the crashes happen at different rows of the .csv.
I have tried with smaller byte arrays and also with more frequent transaction and also with just one transaction but it makes no difference.
Have also tried with AddNonQueryToBatch but for some reason that doesn't work at all.
The code works fine on a smaller .csv (65000 rows)
I am using SQLCipher, latest version.
Any suggestions how to find out what the problem is here?
RBS
RBS
B4X:
Sub CSV2Table3(strFolder As String, _
strFile As String, _
bFileHasFieldNames As Boolean, _
arrFieldNames() As String, _ 'this will be provided by GetCSVProperties
btSeparatorByte As Byte, _
btEncloserByte As Byte, _
btEndOfLineByte As Byte, _
lMaxBytes As Long, _
iRowsToInsert As Int, _
iRowsInCSV As Int, _
strTable As String, _
arrEmisDateCols() As Int, _
bShowProgress As Boolean) As ResumableSub
Dim i As Long
Dim c As Int
Dim x As Int
Dim lRAFFileSize As Long
Dim lPosition As Long
Dim lBytes As Long
Dim lUB As Long
Dim arrBytes() As Byte
Dim bFinalByteBatch As Boolean
Dim iColumns As Int
Dim iRows As Int
Dim lSeparatorPos As Long
Dim lEncloserPos As Long
Dim lChr10Pos As Long
Dim lChr10PosLast As Long
Dim lFirstDataByte As Int
Dim bCSVHasEncloserBytes As Boolean
Dim bExit As Boolean
Dim strSQL As String
Dim iMod As Int
Dim iRowsToDo As Int
Dim iTableCols As Int
Dim iAddNullColumns As Int
Dim bEmisDates As Boolean
bEmisDates = arrEmisDateCols.Length > 0
If bEmisDates Then
DateTime.DateFormat = "dd-MMM-yyyy"
End If
If iRowsToInsert = 0 Then
iRowsToDo = iRowsInCSV
Else
iRowsToDo = iRowsToInsert
End If
'this will be a zero-based UTF8 byte array
'-----------------------------------------
RAF.Initialize(strFolder, strFile, True)
lRAFFileSize = RAF.Size
If iRowsToInsert = 0 Then iRowsToInsert = lRAFFileSize / 2
'declare here as it also used to get the position of the first data byte (after the field names)
Dim arrBytes(1000) As Byte 'this should be enough to get the first row
RAF.ReadBytes(arrBytes, 0, 1000, 0)
If bFileHasFieldNames = False Then
iColumns = GetCSVHeaders(arrBytes, btSeparatorByte, btEncloserByte, btEndOfLineByte).Length
Else
iColumns = arrFieldNames.Length
End If
Dim arrRowData(iColumns) As String
strSQL = "insert into " & strTable & " values(" & MakePlaceHolders(iColumns, iAddNullColumns) & ")"
If bFileHasFieldNames Then
'as we are skipping the the column names
'---------------------------------------
lFirstDataByte = GetCSVFirstDataByte(arrBytes, btEndOfLineByte)
lPosition = lFirstDataByte - 1 'always start the batches of bytes with the previous last Chr(10)
Else
lFirstDataByte = 0
lPosition = 0
End If
lEncloserPos = -1
lSeparatorPos = -1
If bShowProgress Then
If B4XProgressBar1.IsInitialized = False Then
Activity.LoadLayout("ProgressBar")
End If
iMod = CInt(iRowsToDo / 100)
If iMod = 0 Then iMod = 1
B4XProgressBar1.Show(Activity, iRowsToDo, False, 1, "CSV > Table, rows: ", "/", "")
Sleep(0)
End If
Do While True
If bExit Then
Exit
End If
If lPosition + lBytes >= lRAFFileSize Then
Exit
End If
lPosition = lPosition + lChr10PosLast
If lPosition + lMaxBytes > lRAFFileSize Then
lBytes = lRAFFileSize - lPosition
bFinalByteBatch = True
Else
lBytes = lMaxBytes
End If
'ReadBytes (Buffer() As Byte, StartOffset As Int, Length As Int, Position As Long) As Int
'----------------------------------------------------------------------------------------
'Reads bytes from the stream And into To the given Array.
'Buffer - Array of bytes where the data will be written To.
'StartOffset - The first byte read will be written To Buffer(StartOffset).
'Length - Number of bytes To read.
'Position - The position of the first byte To read.
'Returns the number of bytes read which Is equal To Length (unless the File Is smaller than the requested length).
Dim arrBytes(lBytes) As Byte
lBytes = RAF.ReadBytes(arrBytes, 0, lBytes, lPosition)
'get the index of the last btEndOfLineByte in arrBytes
'so we don't go past that in the next bit byte loop
'-----------------------------------------------------
If bFinalByteBatch = False Then
lUB = lBytes - 1
Do While arrBytes(lUB) <> btEndOfLineByte
lUB = lUB - 1
Loop
Else
lUB = lBytes - 1
End If
lEncloserPos = -1
lSeparatorPos = -1
lChr10Pos = 0 'as all the arrBytes will start with byte 10
bExit = False
'so we ignore enclosers in the fields row!
'-----------------------------------------
bCSVHasEncloserBytes = CSVHasEncloserBytes(arrBytes, 0, 0, btEncloserByte)
'so we ignore enclosers in the fields row!
'-----------------------------------------
bCSVHasEncloserBytes = CSVHasEncloserBytes(arrBytes, 0, 0, btEncloserByte)
'not sure this is needed, seems we can process even very large file in one transaction
If General.cConn.bInTransaction Then
General.cConn.EndTransaction
End If
General.cConn.BeginTransaction
If bCSVHasEncloserBytes Then '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If arrBytes(0) = btEncloserByte Then
lEncloserPos = 0
End If
If iColumns > 1 Then '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
''''''''''''''''''''''''''
'SEPARATORS AND ENCLOSERS'
''''''''''''''''''''''''''
For i = 1 To lUB
Select Case arrBytes(i)
Case btSeparatorByte
If c < iColumns And lEncloserPos = -1 Then
If lSeparatorPos = -1 Then
If lChr10Pos = -1 Then
'this will be a separator after a closing encloser!
'--------------------------------------------------
lSeparatorPos = i
Else
If i - lChr10Pos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - 1) - lChr10Pos, "UTF-8")
End If 'If i - lChr10Pos > 1
c = c + 1
End If
lChr10Pos = -1
Else 'If lSeparatorPos = -1
If i - lSeparatorPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 1) - lSeparatorPos, "UTF-8")
End If 'If (i - 1) - (lSeparatorPos + 1) > 1
c = c + 1
lChr10Pos = -1
End If 'If lSeparatorPos = -1
lSeparatorPos = i
End If 'If c < lColumns and lEncloserPos = -1
If bFinalByteBatch And i = lUB Then
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
bExit = True 'as this exit will only exit the Select Case
Exit
End If
Case btEncloserByte
If lEncloserPos = -1 Then
lEncloserPos = i
Else 'If lEncloserPos = -1
If c < iColumns Then
If i - lEncloserPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lEncloserPos + 1, (i - 1) - lEncloserPos, "UTF-8")
End If 'If i - lEncloserPos = 1
c = c + 1
End If 'If c < lColumns
lEncloserPos = -1
End If 'If lEncloserPos = -1
If bFinalByteBatch And i = lUB Then
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
bExit = True 'as this exit will only exit the Select Case
Exit
Else
lSeparatorPos = -1
lChr10Pos = -1
End If
Case btEndOfLineByte
If lEncloserPos = -1 Then
If c < iColumns Then
If arrBytes(i - 1) = 13 Then
If (i - 2) - lSeparatorPos > 0 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 2) - lSeparatorPos, "UTF-8")
End If 'If (i - 2) - lSeparatorPos > 0
c = c + 1
Else 'If arrBytes(i - 1) = 13
If i - lSeparatorPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 1) - lSeparatorPos, "UTF-8")
End If
c = c + 1
End If 'If arrBytes(i - 1) = 13
End If
iRows = iRows + 1
lSeparatorPos = -1
lChr10Pos = i
lChr10PosLast = i
c = 0
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
If iRows = iRowsToInsert Then
bExit = True
Exit
End If
End If 'If lEncloserPos = -1
If bFinalByteBatch And i = lUB Then
bExit = True 'row already processed, so no need to do this again here
Exit
End If
Case Else
If bFinalByteBatch And i = lUB Then
If c < iColumns Then
If i - lSeparatorPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 1) - lSeparatorPos, "UTF-8")
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
End If
End If
bExit = True 'as this exit will only exit the Select Case
Exit
End If 'If bFinalByteBatch And i = lUB
End Select
If bExit Then Exit
Next
Else 'If lColumns > 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'''''''''''''''''''''''''''''
'NO SEPARATORS BUT ENCLOSERS'
'''''''''''''''''''''''''''''
For i = 1 To lUB
Select Case arrBytes(i)
Case btEncloserByte
If lEncloserPos = -1 Then
lEncloserPos = i
Else
If c < iColumns Then
If i - lEncloserPos = 1 Then
c = c + 1
Else 'If i - lEncloserPos = 1
arrRowData(c) = BytesToString(arrBytes, lEncloserPos + 1, (i - 1) - lEncloserPos, "UTF-8")
c = c + 1
End If 'If i - lEncloserPos = 1
End If 'If c < lColumns
lEncloserPos = -1
End If
If bFinalByteBatch And i = lUB Then
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
bExit = True 'as this exit will only exit the Select Case
Exit
Else
lChr10Pos = -1
End If
Case btEndOfLineByte
If lEncloserPos = -1 Then
If c < iColumns Then
If arrBytes(i - 1) = 13 Then
If (i - lChr10Pos) -1 > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) -1 , "UTF-8")
End If
c = c + 1
Else 'If arrBytes(i - 1) = 13
If (i - lChr10Pos) > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) , "UTF-8")
End If
c = c + 1
End If 'If i - lSeparatorPos > 1
End If 'If c < lColumns
iRows = iRows + 1
lSeparatorPos = -1
lChr10Pos = i
lChr10PosLast = i
c = 0
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
If iRows = iRowsToInsert Then
bExit = True
Exit
End If
End If 'If lEncloserPos = -1
If bFinalByteBatch And i = lUB Then
bExit = True 'as this exit will only exit the Select Case
Exit
End If
Case Else
If bFinalByteBatch Then
If i = lUB Then
'If lEncloserPos = -1 Then
If c < iColumns Then
If (i - lChr10Pos) > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) , "UTF-8")
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
End If
End If 'If c < lColumns
bExit = True
Exit
End If 'If lPosition + i + 1 = lRAFFileSize Then 'last file byte
End If 'If bFinalByteBatch
End Select
If bExit Then Exit
Next
End If 'If lColumns > 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Else 'If bCSVHasEncloserBytes<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'''''''''''''''''''''''''''''
'SEPARATORS BUT NO ENCLOSERS'
'''''''''''''''''''''''''''''
If iColumns > 1 Then '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For i = 1 To lUB
Select Case arrBytes(i)
Case btSeparatorByte
If c < iColumns Then
If lSeparatorPos = -1 Then
If lChr10Pos = -1 Then
'this will be a separator after a closing encloser!
'--------------------------------------------------
lSeparatorPos = i
Else
If i - lChr10Pos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - 1) - lChr10Pos, "UTF-8")
End If 'If i - lChr10Pos > 1
c = c + 1
End If
lChr10Pos = -1
Else 'If lSeparatorPos = -1
If i - lSeparatorPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 1) - lSeparatorPos, "UTF-8")
End If 'If (i - 1) - (lSeparatorPos + 1) > 1
c = c + 1
lChr10Pos = -1
End If 'If lSeparatorPos = -1
lSeparatorPos = i
End If 'If c < lColumns
If bFinalByteBatch And i = lUB Then
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
bExit = True 'as this exit will only exit the Select Case
Exit
End If
Case btEndOfLineByte
If c < iColumns Then
If lSeparatorPos > -1 Then
If arrBytes(i - 1) = 13 Then
If (i - 2) - lSeparatorPos > 0 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 2) - lSeparatorPos, "UTF-8")
End If
c = c + 1
Else 'If arrBytes(i - 1) = 13
If i - lSeparatorPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, (i - 1) - lSeparatorPos, "UTF-8")
End If 'If i - lSeparatorPos > 1
c = c + 1
End If 'If arrBytes(i - 1) = 13
Else 'If lSeparatorPos > -1
If arrBytes(i - 1) = 13 Then
If (i - lChr10Pos) - 1 > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) -1 , "UTF-8")
End If 'If (i - lChr10Pos) - 1 > 1
c = c + 1
Else 'If arrBytes(i - 1) = 13
If (i - lChr10Pos) > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) , "UTF-8")
End If 'If (i - lChr10Pos) > 1
c = c + 1
End If 'If i - lSeparatorPos > 1
End If 'If lSeparatorPos > -1
iRows = iRows + 1
lSeparatorPos = -1
lChr10Pos = i
lChr10PosLast = i
c = 0
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
If iRows = iRowsToInsert Then
bExit = True
Exit
End If
End If 'If c < iColumns
If bFinalByteBatch And i = lUB Then
bExit = True
Exit
End If
Case Else
If bFinalByteBatch And i = lUB Then
If c < iColumns Then
If lSeparatorPos > -1 Then
If i - lSeparatorPos > 1 Then
arrRowData(c) = BytesToString(arrBytes, lSeparatorPos + 1, i - lSeparatorPos, "UTF-8")
End If 'If i - lSeparatorPos > 1
Else 'If lSeparatorPos > -1
If (i - lChr10Pos) > 1 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) + 1 , "UTF-8")
End If 'If (i - lChr10Pos) > 1
End If 'If lSeparatorPos > -1
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
iRows = iRows + 1
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
End If 'If c < iColumns
bExit = True
Exit
End If 'If bFinalByteBatch And i = lUB
End Select
If bExit Then Exit
Next
Else 'If lColumns > 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
''''''''''''''''''''''''''''''''
'NO SEPARATORS AND NO ENCLOSERS'
''''''''''''''''''''''''''''''''
For i = 1 To lUB
Select Case arrBytes(i)
Case btEndOfLineByte
If c < iColumns Then
If arrBytes(i - 1) = 13 Then
If (i - lChr10Pos) -1 > 0 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) -1 , "UTF-8")
End If
c = c + 1
Else 'If arrBytes(i - 1) = 13
If (i - lChr10Pos) > 0 Then
arrRowData(c) = BytesToString(arrBytes, lChr10Pos + 1, (i - lChr10Pos) , "UTF-8")
End If
c = c + 1
End If 'If i - lSeparatorPos > 1
End If 'If c < lColumns
iRows = iRows + 1
lSeparatorPos = -1
lChr10Pos = i
lChr10PosLast = i
c = 0
If bEmisDates Then
For x = 0 To arrEmisDateCols.Length - 1
arrRowData(arrEmisDateCols(x)) = General.EmisDate2XLDate(arrRowData(arrEmisDateCols(x)))
Next
End If
General.cConn.SQLMain.ExecNonQuery2(strSQL, arrRowData)
'General.cConn.SQLMain.AddNonQueryToBatch(strSQL, arrRowData)
If bShowProgress Then
If iRows Mod iMod = 0 Then
B4XProgressBar1.Progress = iRows
Sleep(0)
End If
End If
If iRows = iRowsToInsert Then
bExit = True
Exit
End If
If bFinalByteBatch And i = lUB Then
bExit = True 'as this exit will only exit the Select Case
Exit
End If
End Select
If bExit Then Exit
Next
End If 'If lColumns > 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
End If 'If bCSVHasEncloserBytes<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Loop
'Just one big transaction seems OK, even with 2 million rows to insert!
'----------------------------------------------------------------------
General.cConn.EndTransaction
If bShowProgress Then
B4XProgressBar1.Reset
End If
Return iRows
End Sub
Using this on a large file (377887 rows) I get an app crash without any information (also looked at the unfiltered logs).
The other problem that the crashes happen at different rows of the .csv.
I have tried with smaller byte arrays and also with more frequent transaction and also with just one transaction but it makes no difference.
Have also tried with AddNonQueryToBatch but for some reason that doesn't work at all.
The code works fine on a smaller .csv (65000 rows)
I am using SQLCipher, latest version.
Any suggestions how to find out what the problem is here?
RBS
RBS