Page 1 of 1

Merge queries from different DBs

Posted: 05.09.2012, 14:12
by jascha
Hello,

I log data into a sqlite DB. If the DB has a size of 5MB I start a new one. I do this for reasons for performance and data corruption reasons.

Now I do queries on the DB, like give me the data from time x to time y.
When in this timespan there Database has changed, I have to do the queries on several dbs and merge the data afterwards.

My question: Is there an easy way to achive this with zeos?

The several queries just have to be appended into one Dataset. Only the last record of the first query and the first record of the second query need to be merged.

I tried things like having 2 TZQuery objects. query1 doing the query to the first db an query2 to the next. Then append all data from query2 to query1. The problem there is, that this should only be done in memory an not writtin the the real DB.

Any ideas for a good solution?

Posted: 05.09.2012, 14:31
by EgonHugeist
jascha,

Actually the SQLite Backup API is not implemented as far as i know. There are direct plain calls to backup and restore but nobody did implement them before..

Feel motivated to do this.

Posted: 06.09.2012, 18:08
by marsupilami
Hello jascha,

I think your best option for your problem is to use TClientDataset from Delphi or TJvMemoryData from jedi or something like that. Lazarus also has a component like this.
Most probably you will have to copy the records into the target Data Set by yourself. But once you fiish, everything will be in one dataset.
Best regards,

Jan