Página 1 de 1
Write a delimited import routine for a Sqlite table, or import to dbf, then sql insert to sqlite?
Publicado: Mar May 04, 2021 3:29 pm
por DC
Hi,
I'm writing a routine to import two types of delimited files to sqlite tables. One of the files is pipe-delimited, and the other is tab-delimited.
It just occurred to me, that maybe I should import the files into a dbf table first, then insert them into sqlite without writing any import code.
I can do it either way, but how would you approach it? Would there be advantages to using Harbour's native APPEND FROM, e.g. speed?
Re: Write a delimited import routine for a Sqlite table, or import to dbf, then sql insert to sqlite?
Publicado: Mar May 04, 2021 5:29 pm
por ignacio
Hi DC,
It should be easy to do it with:
Código: Seleccionar todo
cLine := MemoLine( cData, nLine)
aLine := Hb_aTokens( cLine, cSeparator )
I recommend to create the SQL string concatenating more than one INSERT operation (check SQLite docs if necessary). Do no exceed of 32 Kb for every multiple insert operation.
Regards
Re: Write a delimited import routine for a Sqlite table, or import to dbf, then sql insert to sqlite?
Publicado: Mar May 04, 2021 11:10 pm
por DC
Sounds good, I'll give it a try, thanks Ignacio.
Got one more question, related to the refreshing of a Listbox. Will open a different thread.
Re: Write a delimited import routine for a Sqlite table, or import to dbf, then sql insert to sqlite?
Publicado: Jue May 06, 2021 10:47 am
por ignacio
Hi,
Sorry I do not understand your question. In any case you CAN NOT do any kind of painting from a thread. The last updating process must be done on the main thread.
I suggest you take a look of the Promises included in Xailer 7 and the sample \future\futuredemo.xpj
Regards,
Re: Write a delimited import routine for a Sqlite table, or import to dbf, then sql insert to sqlite?
Publicado: Jue May 06, 2021 4:39 pm
por DC
I posted the question, figured it out, and then removed it. The REFRESHes are working fine now.
(By 'thread', I mean the thread on the forum, not a thread in an application. Like this thread right here, abou delimited imports).
ignacio escribió: ↑Jue May 06, 2021 10:47 am
Hi,
Sorry I do not understand your question. In any case you CAN NOT do any kind of painting from a thread. The last updating process must be done on the main thread.
I suggest you take a look of the Promises included in Xailer 7 and the sample \future\futuredemo.xpj
Regards,
Re: Write a delimited import routine for a Sqlite table, or import to dbf, then sql insert to sqlite?
Publicado: Jue May 06, 2021 7:59 pm
por ignacio