Clone Dataset (Tzquery) in Delphi 7

Asked

Viewed 274 times

1

Hello, I have an application in Delphi that does the following: Make a query in the Postgresql database using the Zeos Tzquery/Tzconnection components, then scroll through the result and save it in another table, table with columns identical to the columns generated from the previous query.

It works, however, the amount of records is very large and going through all these records 1 to 1 takes a long time. Here I decided to divide this work of going through Dataset using threads, but I stopped in a problem that is the following:

I can’t create new table instances (Dataset), so I can’t work the parallelism. Someone has an idea of how to solve this?

Excerpt from how I am running and how I tried to run respectively:

qry := TZQuery.Create(nil);
qry := DM.Qry_Levantamento;
--------------
qry := TZQuery.Create(nil);
qry.Assign(DM.Qry_Levantamento);

I also thought about doing all this by Query, but I haven’t taken it any further because I don’t know if I can apply this SQL parallelism. Thank you!

1 answer

3


Good morning Rafael.
If I understand correctly what you want.. : ) one of the solutions would be to use a direct sql command.. It would look like this ..:

Insert into TABELA_DESTINO Select * from TABELA_ORIGEM  Where TABELA_ORIGEM.CAMPO = 'XXX'

I tested this command in PARADOX and MYSQL, it worked perfectly and fast.
Any doubt just talk.
I hope I helped. Hugs.. :)

  • It worked much better than I expected, always good to ask for advice after hitting head atoa... Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.