Solved

Apply database update

Posted on 2001-08-07
12
164 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
Industry Leaders: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

707 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