Link to home
Start Free TrialLog in
Avatar of juru
juru

asked on

TTable.Refresh

I'm writing a Paradox application in Delphi4. Can anyone tell me when/how often I should use TTable.Refresh

Is there an equivalent to make sure that all data are written to the disk?
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi juru,

Refresh, you can do it after each post, or so often you need a actual dataset

FlushBuffers, to force the writeback, but attention the OS will cache also

meikl
Avatar of kotik
kotik

To be sure that all data is written to disk you have to close the table and then reopen.

Table.Close;
Table.Open; // it is not necessary

I tried all: Post, ApplyUpdates and so on, but only closing the table helped me.
either use

bde command "DbiSaveChanges" or
bde command "DbiUseIdleTime"

! - DbiSaveChanges is not supported w/ sql tables

BlackDeath.
hit me - not bde command: idapi sdk function...

;-)
BlackDeath.
hit you, bd,

one remark
DbiSaveChanges is called by FlushBuffers

meikl ;-)
okokokok.

but there's still the sql problem, ain't it (?)

:-|

StupidDeath.
Avatar of juru

ASKER

Hi BlackDeath

Could you please post an answer with a complete code snippet using  DbiSaveChanges and DbiUseIdleTime. I'm not familiar with anything outside of normal Delphi code.

Thanks

hi all,

a part from the vcl-source

procedure TBDEDataSet.FlushBuffers;
begin
  CheckBrowseMode;
  Check(DbiSaveChanges(Handle));
end;

bd, do your job now ;-)

meikl
if u've got sql u have 2 use DbiSaveChanges, since DbiUseIdleTime doesn't work w/ sql:

that one is 2 b used explicitly, i.e. every time u wanna write the changes 2 disk, u've gotta make a call 2 DbiSaveChanges like this:

...
Table1.Edit;
Table1.FieldByName('Name').AsString := 'Mr. X';
Table1.Post;
DbiSaveChanges(Table1.Handle);
...

this way u can control when the changes r updated.

if u've got no sql, u can use DbiUseIdleTime.

just put it in2 the applications onidle:

TForm1.FormCreate(Sender: TObject);
...
Application.OnIdle := MyIdle;
...

TForm1.MyIdle(Sender: TObject; var Done: Boolean);
begin
  // if u set Done 2 False, this procedure will not call win api's waitmessage so this procedure will b called repeatedly, what'd cause excessive cpu-time...
  DbiUseIdleTime;
end;

don't 4get 2 put DbiProcs in the uses-clause.

ok, that's it.
if this is enough, tell me, & i'll post an answer; if not, ask.

cheerio,

BlackDeath.

Avatar of juru

ASKER

Hi folks

You've made me perfectly happy. I'll gladly give away my 50 points. I guess I owe them to the one who first posts an answer instead of a comment.

Please advise, if I'm wrong.

juru
ASKER CERTIFIED SOLUTION
Avatar of BlackDeath
BlackDeath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
kretzschmar,

i'll post a q 4 u w/ 1/2 the pts (i.e. 25) & same rating i'll get from juru if that's ok 4 u.

(i've got pts enough ;-))

BlackDeath.
hi bd,

i've offered eps a similar option
his comment

---paste begin
Well meikl, if you insist do so, but it's fine with me if you just answer this one and
keep your points. It may not be fair towards other E-E users since there are
more points involved when you post a 'dummy' question.

I will see your dummy question passing by if you don't agree with me or just don't
care about it.
---paste end

i agree with him, therefore keep your points, juru has decide to give the points to you and of course you have done a good job ;-)

meikl
thanx 4 compliment.

;-)

Black-o-Death.
Avatar of juru

ASKER

100 pts to BlackDeath and kretzschmar with thanks to all who contributed.

juru
hey, kretzschmar -
whaddabout asking linda 2 transfer 200 pts from my experts account 2 yours?
(that'd b legal, ain't it? - & juru's intention, i think)

BlackDeath.
well, we can try, who will ask ?
Avatar of juru

ASKER

Aren't you guys exagerating? By 100 pts to bd and k I meant 50 + 50=100 total
juru - u graded the answer a, which means i get 100 pts * 4 (grading a). thus, my account swelled by 400 pts.

it's only fair 2 give the 50 pts to kretzschmar w/ the same factor, i.e. 50 pts * 4 = 200.

kretzschmar - i'll ask her.

bye & have a nice day,

BlackDeath.
;-) hi juru,

expert-points are depending on your grading
example

you have post a 100 Points q
the expert get if you grade with
A -> 400 Expertpoints
B -> 300 Expertpoints
C -> 200 Expertpoints
D -> 100 Expertpoints

well bd have now get 400 expertpoints from this q
and will give me 200 expertpoints.

well, i don't know if this will be possible

meikl
just not seen your comment bd,
have a nice day too

meikl ;-)
Avatar of juru

ASKER

wow, seems to be one of those days where I learn a lot of new stuff ;-)
There is currently no direct way to divide points between experts (it is an improvement we plan to add).  So we need to work around the programming when situations like this arise.

Since BlackDeath has already been awarded points for his participation, I will post a question for kretzschmar to award an equal number of points.

kretzschmar, look for a question directed to you in this topic area.  Thanks for the great cooperation in finding a solution :-)  I really like the teamwork.

Linda Gardner
Customer Service @ Experts Exchange
well, Great, Linda, many thanks. meikl ;-)
isn't linda an angel?
;-)
BlackDeath.
isn't linda an angel?
;-)
BlackDeath.
yup, she is an angel ;-)
Thanks for all experts-exchnage team, really they do a great job.

Now I make ex-ex my default homepage in my internet explorer.

Motaz
www.geocities.com/motaz1