Events for cDbUpdateVersion
Name |
Type |
Description |
OnUpdate |
Procedure |
Automatically called when object is created. This is where the programmer places any code to update the database. |
Sample
// These are needed to keep the compiler happy;
Declare_Datafile Customer
Declare_Datafile Invt
Declare_Datafile OrderDtl
Declare_Datafile OrderHea
Declare_Datafile OrdSys
Declare_Datafile SalesP
Declare_Datafile Users
Declare_Datafile Vendor
Object oDbUpdateHandler is an cDbUpdateHandler
Set Data_File_Field to File_Field DbVersion.DatabaseVersion
Object oUpdateVersion1.1 is a cDbUpdateVersion
Set pnVersionNumber to 1.1
Set pbUseConnectionID to True // Default = True
Set pbCopyData to True // Default = True
Set pbRecnum to True // Default = True
Set pbToANSI to True // Default = True
// If the psDriverID is not set it is read from the SQLConnections.ini file.
Procedure OnUpdate
Boolean bOK
Get ApiTableConvertToSQL Invt.File_Number to bOK
Get ApiTableConvertToSQL OrderHea.File_Number to bOK
Get ApiTableConvertToSQL OrderDtl.File_Number to bOK
Get ApiTableConvertToSQL OrdSys.File_Number to bOK
Get ApiTableConvertToSQL SalesP.File_Number to bOK
Get ApiTableConvertToSQL Vendor.File_Number to bOK
End_Procedure
End_Object
Object oDbUpdateVersion1.2 is a cDbUpdateVersion
Set pnVersionNumber to 1.2
Procedure OnUpdate
Boolean bOK
Get SQLColumnRename Customer.File_Number "Purchases" "YearlyPurchases" MSSQLDRV_ID to bOK
Get SQLColumnAdd Customer.File_Number "IsPrinted" DF_BCD_DUF 4 0 True "1" to bOK
// Alternate table conversion function that instead of setting properties like in
// above passes a series of parameters.
Get ApiTableConvertToSQL_Ex Users.File_Number MSSQLDRV_ID True True True True to bOK
End_Procedure
End_Object
Object oUpdateVersion1.3 is a cDbUpdateVersion
Set pnVersionNumber to 1.3
Use VersionUpdate3.pkg
:
End_Object
End_Object