Solved

Apply database update

Posted on 2001-08-07
12
157 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
  • 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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