| ActivePatch Developer's Guide - Creating Patch Files | ||
|
Before creating a patch file, we need to have two different versions of the same file, with one being the reference (original) version and the other the updated version. For the purposes of these examples, a moderately large Microsoft Access database, with approximately 10,000 records, will be used. Of course, any type of file can be used, however the specifics in terms of the compression ratio will differ from file to file. The reference version of the file will be named house1.mdb, and the modified version of the file will be named house2.mdb. The modified version of the database has had several records removed and added. The size of the two database files are approximately 1.3 Mb each, with a compressed size of approximately 450 Kb. To create a patch file based on the differences between the two versions of the database, place the PatchFile control on a form and call the Create method as follows: ' Create a patch file based on the differences between two ' versions of a database PatchFile1.FileName = "house.pat" PatchFile1.Password = "secret" PatchFile1.Level = apDefaultLevel On Error Goto CreateFailed PatchFile1.Create "house1.mdb", "house2.mdb" Exit Sub CreateFailed: MsgBox Err.Description Exit Sub The FileName property specifies the name of the patch file to create. This may be any legal file name, with any extension that you choose. In these examples, we will use the extension ".pat" to refer to individual patch files, and the extension ".pkg" to refer to patch packages. However, there are no requirements that you use these extensions in your own code, and ActivePatch does not make any assumptions about the contents of a file based on its extension. The Password property specifies the password used to secure the patch file. This prevents the patch from being applied unless the same password is provided when the Apply method is called. If you do not want to require a password, then an empty string can be specified. The Level property specifies the patch level that is to be used when creating
the patch. This is a value between one and nine, with a value of zero specifying the
default level. In most cases, it is recommended that you use
The Create method is then called, with the first
parameter specifying the name of the reference (original) file, and the second parameter
providing the name of the updated file. If an error occurs during the creation of the
patch file, the error trap is triggered. In this case, a description of the error is
displayed and the subroutine exits. If the Create method succeeds, the file
|
||