Solved

Cache Updates

Posted on 1997-07-24
4
204 Views
Last Modified: 2010-04-04
I've made an application that uses Cache Updates to save records in tables when I'm sure I want to save them or be able to discard them if I change my mind or they are incorrect. The problem is that I want to make a 'Find key' of the records physically saved in the tables and the records that are awaiting to be saved. Anyone knows how can I do that? Thank you.
0
Comment
Question by:girona
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
icampbe1 earned 100 total points
ID: 1339693
Since the records in cache and those that have already been posted are all 'logically' the same, a key reference will not be able to separate them.
If you need to have a lot of control over the cached records, I would suggest that you use a 'staging' file (dataset).  When you are certain that you want to post, them transfer from the staging file to the real dataset.

This is a bit more work, but you do get several benefits.  You can refer to the new records separately from the posted ones (like you want to do).  You can create some nifty 'smart' locking mechanisms beacuse you can now 'batch' update your database (instead of holding long locks).  You can create some very strong roll-back mechanisms.

It is a bit more work, but the flexibility and benefits are quite high.

Ian C.

0
 

Author Comment

by:girona
ID: 1339694
I asked that question in order not to do the temporary table and work on it. What I want is using Cache Updates be able to accede all the records indistinctively. I don't want to use temporary tables because it is more work and they are slower to control and copy a lot of records in a temporary table and after that copy them again in the final table.
0
 

Author Comment

by:girona
ID: 1339695
I've made an auxiliar table and when I want to save the data I use the 'BatchMove' function and then I empty the auxiliar table with EmptyTable. Do you know if there is any way of doing that better? Thanks.
0
 
LVL 2

Expert Comment

by:icampbe1
ID: 1339696
Not really, you have to move the records (kinda like posting them) and then empty the dataset.   I know you feel that this is a bit of extra work, but you can make it all one step.  Just write a single routine called MyPost and put it in there.  

I don't know your experience level, but you could subclass TTable and make all your routines methods of a new component TStagingTable and use that all the time instead (actually, I like that idea).  

Once you have implemented this, you will have a very good base to build around (see my previous notes).

The need that you had to identify the 'cached' records is just one example of the things that you can now do.  If you ever need to implement  a good rollback mechanism, you will have a good start.

Cheers,
Ian C.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 10 Seattle Dataset Actions 5 79
Delphi IDE crash without error message ... 7 76
tidtcpserver connection lost handle 2 71
FMX and jaudiotracker playing memory stream 29 66
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now