Board index » delphi » Zipping an open table

Zipping an open table

Quote
p...@erols.com wrote:

> Help.  I am trying to zip up a series of DBase tables.  Before
> launching PKZIP, I post any pending writes, close the tables, and then
> launch DOS PKZIP from my Delphi application.  Even though I have set
> open tables to ACTIVE=FALSE, PKZIP still sees them as open and
> bypasses them.  Does the BDE keep the table in an open state even
> though the Delphi app closes it?  After terminating the Delphi
> application, PKZIP zips the previously open tables just fine.  Any
> thoughts?  I know I can do different work-arounds, but I would prefer
> to zip the table from within my Delphi app.

> Also, is it possible, in general,  to copy and/or compress an open
> DBase table on-the-fly to a different directory?  It would be great to
> be able to get a backup snapshot of a network database (minus pending
> posts).

> Thanks in advance...Jerry Kashtan

I regularly use a zip component to backup and restore from the
application that uses the tables.  I use Table1.Close, instead of active
:= false (don't know if there is a difference).  One other thought...
Are you running your program from the IDE and have Table set to active
in the object inspector?
--
A government big enough to give everything you want,
is big enough to take all you have.   Ronald Reagan.

tjk20@<nospam>centurion.flash.net

 

Re:Zipping an open table


I've also noticed that there is often some caching being done.  Sometimes
calling the flushbuffers method works (I've only heard second hand that
there are times when it doesn't) but another way is to use a TDatabase
object and call it's close method which is a much more forceful closing.
Seems to force the caching to clear out and the files are free to do with as
you please.  (I think....;)  )

Hope this helps,

Max

                  ///
                / ^ \         Downey Communications Inc.
               ( o-o )        Programmer/Analyst
---oOOO--(_)--OOOo------------------------------------------
    .oooO               'OOPS...Was that your foot?'
    (   )   Oooo.
-----\ (----(   ) ------------------------------------------
      \_)    ) /
            (_/     Allen A. Maxwell
        email:      aa...@sprynet.com
        snail Mail: 649 Hollywood Ave.
                    Salt Lake City, Ut. 84105
        voice:      801 486-7208

Quote
Timothy J. Kelly wrote in message <34974D23.5...@centurion.flash.net>...
>p...@erols.com wrote:

>> Help.  I am trying to zip up a series of DBase tables.  Before
>> launching PKZIP, I post any pending writes, close the tables, and then
>> launch DOS PKZIP from my Delphi application.  Even though I have set
>> open tables to ACTIVE=FALSE, PKZIP still sees them as open and
>> bypasses them.  Does the BDE keep the table in an open state even
>> though the Delphi app closes it?  After terminating the Delphi
>> application, PKZIP zips the previously open tables just fine.  Any
>> thoughts?  I know I can do different work-arounds, but I would prefer
>> to zip the table from within my Delphi app.

>> Also, is it possible, in general,  to copy and/or compress an open
>> DBase table on-the-fly to a different directory?  It would be great to
>> be able to get a backup snapshot of a network database (minus pending
>> posts).

>> Thanks in advance...Jerry Kashtan
>I regularly use a zip component to backup and restore from the
>application that uses the tables.  I use Table1.Close, instead of active
>:= false (don't know if there is a difference).  One other thought...
>Are you running your program from the IDE and have Table set to active
>in the object inspector?
>--
>A government big enough to give everything you want,
>is big enough to take all you have.   Ronald Reagan.

>tjk20@<nospam>centurion.flash.net

Re:Zipping an open table


Hi there,
i didn't get the original posting, only the replies, but i had a similar
problem with D1/Win3.11:
If you simply call PKZIP, your app doesn't stop and waits for pkzip to
return, so if pkzip started and is trying to zip your table, your app has
already opened the tables again...
Here's a code snippet, i found somewhere, which calls a program and waits
for it to finish:

Function WinExecAndWait(Path : string; Visibility : word) : word;
var
  InstanceID : THandle;
  PathLen : integer;
begin
  { inplace conversion of a String to a PChar }
  PathLen := Length(Path);
  Move(Path[1],Path[0],PathLen);
  Path[PathLen] := #00;
  { Try to run the application }
  InstanceID := WinExec(@Path,Visibility);
  if InstanceID < 32 then { a value less than 32 indicates an Exec error }
     WinExecAndWait := InstanceID
  else begin
    Repeat
      Application.ProcessMessages;
    until Application.Terminated or (GetModuleUsage(InstanceID) = 0);
    WinExecAndWait := 32;
  end;
end;

You call this like
...
  Screen.Cursor := crHourGlass;
  try
    i := winexecAndWait('PKUNZIP.EXE', sw_Show);
    if i < 32 then ShowMessage('Table could not be ziped' (WinExec-Error ' +
IntToStr(i) + ')');
  finally
    Screen.Cursor := crDefault;
  end;
...

Hope this helps
Dieter
--
if you want to email me please remove .xxx

Quote
Timothy J. Kelly wrote in message <34974D23.5...@centurion.flash.net>...
>p...@erols.com wrote:

>> Help.  I am trying to zip up a series of DBase tables.  Before
>> launching PKZIP, I post any pending writes, close the tables, and then
>> launch DOS PKZIP from my Delphi application.  Even though I have set
>> open tables to ACTIVE=FALSE, PKZIP still sees them as open and
>> bypasses them.  Does the BDE keep the table in an open state even
>> though the Delphi app closes it?  After terminating the Delphi
>> application, PKZIP zips the previously open tables just fine.  Any
>> thoughts?  I know I can do different work-arounds, but I would prefer
>> to zip the table from within my Delphi app.

>> Also, is it possible, in general,  to copy and/or compress an open
>> DBase table on-the-fly to a different directory?  It would be great to
>> be able to get a backup snapshot of a network database (minus pending
>> posts).

>> Thanks in advance...Jerry Kashtan
>I regularly use a zip component to backup and restore from the
>application that uses the tables.  I use Table1.Close, instead of active
>:= false (don't know if there is a difference).  One other thought...
>Are you running your program from the IDE and have Table set to active
>in the object inspector?
>--
>A government big enough to give everything you want,
>is big enough to take all you have.   Ronald Reagan.

>tjk20@<nospam>centurion.flash.net

Other Threads