I am trying to import a csv into sqlite with
lst1 = su.LoadCSV(FDir, FName, ",")
This csv has almost 250,000 lines, with 7 columns
There are many fields in different columns that contain the single quote character inside the text of the column
ie: d'Azure, O'Mahoney,
The sqlite insert command chokes on this text field.
SqlStr="INSERT INTO DMR_Contacts (ID,RadioID,Callsign,Name,Name2,City,State,Country) VALUES ("&i&","&sC(0)&",'"&sC(1)&"','"&sC(2)&"','"&sC(3)&"','"&sC(4)&"','"&sC(5)&"','"&sC(6)&"')"
SQL.ExecNonQuery(SqlStr)
My app downloads this csv and imports it into SQLite
The following works but is dreadfully slow, and changes the meaning of the text
sC = lst1.Get(i)
If sC(3).Contains("'") Then
sC(3)=sC(3).Replace("'","")
End If
If sC(3).Contains("'") Then
sC(3)=sC(3).Replace("'","")
End If
If sC(4).Contains("'") Then
sC(4)=sC(4).Replace("'","")
End If
If sC(5).Contains("'") Then
sC(5)=sC(5).Replace("'","")
End If
I have spent many hours fighting this issue>
I and not a real programmer, just a newbie (3 weeks on B4J)
Any suggestions would be greatly appreciated
lst1 = su.LoadCSV(FDir, FName, ",")
This csv has almost 250,000 lines, with 7 columns
There are many fields in different columns that contain the single quote character inside the text of the column
ie: d'Azure, O'Mahoney,
The sqlite insert command chokes on this text field.
SqlStr="INSERT INTO DMR_Contacts (ID,RadioID,Callsign,Name,Name2,City,State,Country) VALUES ("&i&","&sC(0)&",'"&sC(1)&"','"&sC(2)&"','"&sC(3)&"','"&sC(4)&"','"&sC(5)&"','"&sC(6)&"')"
SQL.ExecNonQuery(SqlStr)
My app downloads this csv and imports it into SQLite
The following works but is dreadfully slow, and changes the meaning of the text
sC = lst1.Get(i)
If sC(3).Contains("'") Then
sC(3)=sC(3).Replace("'","")
End If
If sC(3).Contains("'") Then
sC(3)=sC(3).Replace("'","")
End If
If sC(4).Contains("'") Then
sC(4)=sC(4).Replace("'","")
End If
If sC(5).Contains("'") Then
sC(5)=sC(5).Replace("'","")
End If
I have spent many hours fighting this issue>
I and not a real programmer, just a newbie (3 weeks on B4J)
Any suggestions would be greatly appreciated
Last edited: