Recent

Author Topic: Database - good style searched  (Read 204 times)

Nicole

  • Sr. Member
  • ****
  • Posts: 461
Database - good style searched
« on: August 11, 2022, 05:44:27 pm »
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

  • Sr. Member
  • ****
  • Posts: 397
Re: Database - good style searched
« Reply #1 on: August 11, 2022, 06:03:43 pm »
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.
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.
What 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.

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?
One connection per thread is my way. Its easier to handle connections, when you are using a concurrent users limited database.
 

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.


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.


At the moment I use Windows. In the long run I want to change to Linux.
same thing regardless of the underline OS.

 

TinyPortal © 2005-2018