Solved

Apply database update

Posted on 2001-08-07
12
162 Views
Last Modified: 2012-05-04
Hi,

I create a database and now my problem is when I do Post, it's not actually write to disk.

I want to make it write to disk directly without caching it. How ???

Now I have several TTable and TDataSource components bind to several tables. But I use one navigation and one TDatasource to be the main user control to control those tables. How can I create a single direct write (without caching it) in this navigation TDataSource ? or should I do it for each tables ?

Anyway I know about ApplyUpdates and CommitChange in TTable, is using this is the right way ? Since in Delphi help it said doing ApplyChange still doesn't write it to disk.

Please give me a simple sample on correcting this problem :) thanks
0
Comment
Question by:comicboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
12 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6362670
what about

ttable.flushbuffers?
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6362715
There is a difference between cached updates and transactions. It sounds to me like you want to perform a transaction.

Transactions...as you may know... do write directly to disk. There are three levels (Look for Database.Transisolation in the help files)
tiDirtyRead
tiReadCommited
tiRepeatableRead

These are set in the Database Component. It encapsulates every database connection in Delphi, thus if you set its transisolation property to one of the three transactions listed above you should be in business!
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6362791
>Transactions...as you may know... do write directly to disk

really?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:gemarti
ID: 6362912
What is your point? Educate me!
Perhaps my wording was poor.

 
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6362929
guessing comicboy is using paradox or dbase with bde

a transactionmode can there only be tiDirtyRead
and does nothing else as lock the records which may modified during the transaction, but written is then when the transaction is committed

and the modifications are also not written at once,
they are cached until the bde becomes idle also
they may cached also in the os-cache

the ttable.flushbuffers method forces the bde
to write the pending cachebuffers to disk

to ensure that the os-also do write its pending cache,
the table must be closed and reopened

meikl ;-)
0
 

Author Comment

by:comicboy
ID: 6365305
Well what kretzschmar says might be what I want to know, you're right that I'm using Paradox in BDE. But now it turns to be scary to know that to make sure it is saved I must close and reopen the table ? wow and so if I want to make sure each time a post really written I should close it and open it immediately after I post it ?

Well that's really a terrible way, but I will do that anyway, I'll test it tommorow... :)

For gemarti, I do read in help about Database component thingy before I post this in EE but I'm so sorry I didn't use it in my app. I'm really new to database programming and still very poor on using this or that and so I don't understand what to do with database component with my app. anyway... and the ultimate thing is I don't know about anything else in database except TTable and TDatasource. That is why in my other EE question MNasman teach me on using ADO or somekind like that but too bad I don't have time yet to do it since my current assignment is still too much...

thanks for gemarti and kretzschmar...
0
 

Expert Comment

by:faustomen
ID: 6365832
0
 

Expert Comment

by:faustomen
ID: 6365834
0
 

Expert Comment

by:faustomen
ID: 6365844
0
 

Expert Comment

by:faustomen
ID: 6365869
Hi,

I worked with Paradox in BDE for a long time and I also had this same problem for a long time, till I find the solution. There is a function called DbiSaveChanges that forces writes to disk. This function can be found in BDE's API help, not in Delphi's help. To use it, you can create a procedure called fDbiSaveChanges, for instance, like the code below.

procedure TForm1.fDbiSaveChanges(hTmpHandle:hDBICur);
begin
  Check(DbiSaveChanges(hTmpHandle));
end;

In order to this procedure works, you must include the units BDE and DBTables in the USES clause of the unit.

Then, after your Post calls, you must call fDbiSaveChanges, like this:

fDbiSaveChanges(TTable.Handle);

replacing TTable with the table you want.

That's all you need to do. Hope it works!
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 6365915
flushbuffers calls exact this, faustomen
0
 

Author Comment

by:comicboy
ID: 6366894
Wow, you're all are experts, I'm just hear this things today about BDE from you all.

Anyway I've tried what kretzchmar said and it's working ok I even do Close and Open TTable each Post to make sure it written to disk.

But how am I measure it is success still not too obvious since what I do is I post then I press <Ctrl> <F2> in Delphi to make the program close immediately. Then I reopen it and well the record is there...

What exactly my problem with this is happen like this when I input so many data then the electricity power goes down my computer off then my data is lost. That is why I'm asking how to make sure each posting is written ASAP.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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