Step 1 Step 2 Step 3 Step 4

Step 5. Customizing master-detail mechanism.

FIBPlus also allows setting some peculiarities of master-detail mechanism work. As you remember in particular in our example we have opened the detail-dataset (pFIBDataSet2) manually. It is simple if we deal with a simple link, but if we use several master-detail links or longer links (master-detail-subdetail), manual opening of all queries can cause an error. You must always open a detail query after the main one. For avoiding unnecessary coding TpFIBDataSet contains a special DetailOptions property:

Figure 15.

If setting the dcForceOpen key we can be completely sure that the detail-query will be automatically open after opening the master-query. Now we can delete the pFIBDataSet2.Open string form our program. Whatever the complexity of master-detail links is, all the queries will be open in the necessary order.

The second important option is the dcWaitEndMasterScroll key. Imagine that a user is navigating on DBGrid1 trying to find a necessary department. With each his movement when the current record in DBGrid1 changes, pFIBDataSet2 automatically reopens the query. It is obvious that navigation on the master-table will cause a number of rather complex queries, which will considerably increase the net-traffic. In practice we needed to reopen the detail-query only once when the user has finally found the department in DBGrid1. FIBPlus helps to avoid redundant queries. If the dcWaitEndMasterScroll key is added to DetailConditions, the detail-query will reopen only after some interval (the interval value can be regulated by setting values of WaitEndMasterInterval).

Thus when the user simply navigates on DBGrid1, the change of the current record activates the timer of the detail-query. If during the interval the user has time to pass on to another record, the timer will be restarted. This will happen until the user stops on the necessary record. The detail query reopens only after this and that means that pFIBDataSet2 executes only one query instead of a series of them.

Conclusion

Now you know how FIBPlus master-detail links work, how to connect to the database, execute a select query and generate modifying ones, work with data in the context of two transactions and link master and detail datasets. Though the described approach is very simple we recommend you to study the examples thoroughly.

Step 1 Step 2 Step 3 Step 4


Preview text: Devrace FIBPlus: Peculiarities of master-detail mechanism in the course of work with InterBase. Step 5.
Prices in Euro:

235 (1 copy)
1250 (unlimited)

Volume discounts are available...

Navigation



We are a small software company with thousands of customers delivering comany wide systems including accounting, logistics, e-commerce, POS, sales etc etc. Several years ago, when we were still a very small company, we used Delphi 3 and Paradox combined with BDE. As our system (and customer base) grew I decided to switch to Delphi 5 and Interbase. Being a huge improvement over Delphi 3 and Paradox, I encountered numerous problems with IBX: memory leaks, performance issues and other problems. Borland was not to be bothered: IBX was provided "as is" and no support was avaliable. 
Not being very eager to use third party components with Delphi at first, I decided to give FIBPlus a try. At once all problems where gone: no more memory leaks and  performance was very consistent. 
But the real advantage of switching to FIBPlus came with the upgrade to D2005: after upgrading there were some problems with the new FIBPlus version. After emailing the problem I received an update within an hour! And this was at 11 pm! A few other (smaller) errors where handled in the same way. 
Our motto is: software is as good as its support. And support of Devrace is just great!
Just a little indication of our FIBPlus use: all our software runs 100% on FIBPlus. Our customers have a total of aprox. 4.800 Firebird databases in production, with a combined size of over 130TB and over 80 million transactions a day. Every
day. And FIBPlus has not failed a single transaction. Not once. There is, however, one (minor) drawback in using FIBPlus: while debugging an application which uses and invalid SQL instruction, de Delphi Debugger returns to the FIBPlus code instead of to our calling code (where the actual error comes from), thereby complicating de debug proces a little. But that is a very small price to pay for a otherwise brilliant third party solution! >>

Bas Jordans JorSoft Ltd
FOR CUSTOMERS
Download full versions and updates in your Personal Area