Database - good style searched lazarus / 16-Databases ---------------------------------------------------------------------- Nicole · 2022-08-11 15:44 I have quite a lot of frames. Many of them are data sensitive. I use Interbase 2.5 and made myself an unit DBModul. What is good style to save where? At the moment I put my datasource into the frame which it needs it. What about datasets? Is it a good idea to put it into the DBModul or into the Frame, which uses it? Can anybody hint me of "how many"? I made a DB connection. Shall I leave it with "one" or shall I make more of them? What about transactions? Will every frame need its one, every query its own? What are the advantages or disadvantages in doing the one or the other by Interbase? At the moment I use Windows. In the long run I want to change to Linux. ---------------------------------------------------------------------- HeavyUser · 2022-08-11 16:03 Quote from: Nicole on August 11, 2022, 05:44:27 pmI have quite a lot of frames. Many of them are data sensitive. I use Interbase 2.5 and made myself an unit DBModul. What is good style to save where? At the moment I put my datasource into the frame which it needs it. That's the correct spot. a Datasource is used to quickly change the source of data from one dataset to the next with out the need to iterate through all the data edits on the frame. Quote from: Nicole on August 11, 2022, 05:44:27 pmWhat about datasets? Is it a good idea to put it into the DBModul or into the Frame, which uses it? Usually they belong in a datamodule and linked to the datasource, just remember you can have a datamodule for each frame or any other kind of grouping for your data you like, do not try to put everything in a single datamodule. It will be problematic in the long run. Quote from: Nicole on August 11, 2022, 05:44:27 pmCan anybody hint me of "how many"? I made a DB connection. Shall I leave it with "one" or shall I make more of them? One connection per thread is my way. Its easier to handle connections, when you are using a concurrent users limited database. Quote from: Nicole on August 11, 2022, 05:44:27 pm What about transactions? Will every frame need its one, every query its own? I usually have a single transaction for all datasources except the ones that are transaction sensitive ee financial transactions. One transaction per frame should work fine too, just don't have long running transactions its not good for your data. Quote from: Nicole on August 11, 2022, 05:44:27 pm What are the advantages or disadvantages in doing the one or the other by Interbase? Same as all transaction aware servers. Once a transaction is committed/canceled the active datasets are closed (use commit retaining). Depending on transaction type, changes in one part of your application will not be visible in an other transaction of the same application until the first is committed and the second refreshed. For more info please read up on firebird transactions. Quote from: Nicole on August 11, 2022, 05:44:27 pm At the moment I use Windows. In the long run I want to change to Linux. same thing regardless of the underline OS.