Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DatabaseBackup With MoleZip

Status
Not open for further replies.

mkendi

Programmer
Oct 21, 2000
82
TR
In this forum until today I was always a "taker". Now I think its time to change my behavior. :)

1. Download MoleZip.dll form 2. Register it with RegSvr32
3. Now you can call BackupDatabase( cDatabase, lSilent )
4. BackupDatase is using another function OpenDatabaseExclusive( cDatabase ). There I try to open the database exclusive, to be sure, no one else is using the database.
This function you have to write yourself

*********************************************
* BackupDatabase
*********************************************
FUNCTION BackupDatabase( cDatabase, lSilent )
LOCAL oZip, cFName, cTime, cDir, nRow, nAnz
LOCAL nTotalSize
LOCAL ARRAY aMyArray(1)

cTime = TIME()
cFname = DTOS(DATE()) + "-" + SUBSTR(cTime,1,2) + SUBSTR(cTime,4,2) + ".zip"
cDir = SYS(2003) && current dir

* Calculate TotalSize: later a Progressbar will show the status
CD DATA
nAnz = ADIR(aMyArray)
nTotalSize = 0
FOR nRow = 1 TO nAnz
nTotalSize = nTotalSize + aMyArray(nRow,2)
ENDFOR
CD ..
*----
IF !OpenDatabaseExclusive( cDatabase )
RETURN
ENDIF
CLOSE DATABASES ALL

oZip = CREATEOBJECT("MoleZip.ZipFile")
oZip.CREATE(cFname)
CD DATA

FOR nRow = 1 TO nAnz
oZip.PackInplace(aMyArray(nRow,1),aMyArray(nRow,1),6)
ENDFOR
oZip.CLOSE()

CD ..
OPEN DATABASE (cDatabase) SHARED
OpenMyTables()
IF !lSilent
MESSAGEBOX("Backup FileName is " + cFName ",0, gcPrg_Version)
ENDIF
ENDFUNC
 

Thank you for this contribution.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
My first star!

Your profile seems to suggest that this is your third.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, this means, that someone must give me stars for my (intelligent ?) requests and questions. :)))

 
Mike, this means, that someone must give me stars for my (intelligent ?) requests and questions

It does'nt seem to be case, take a look at thread184-743001 and thread184-156113


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top