Class: cDbUpdateLogFile
See Also: Overview of the DataFlex Database Update Framework
Properties Events Methods
Hierarchy
cObject
---cDbUpdateHandler
------cDbUpdateVersion
------cDbUpdateFunctionLibrary
------cDbUpdateLogFile
------cDbUpdateUserCount
------cSQLConnectionHandler
---------cSQLConnectionIniFile
---------cDbUpdateDatabaseDriver
Library: Windows Application Class Library
Package: cDbUpdateLogFile.pkg
Description
Child class to the cDbUpdateHandler class. An instance of this class is automatically created by the cDbUpdateHandler class.
The cDbUpdateLogFile class controls how error and status messages are handled. While an update is taking place all error messages are redirected to the error handler in the cDbUpdateHandler container object. There all errors and status messages are saved to a struct array. After all updates have been done the CreateErrorLogFile message of this class is called, passing the struct array.
The default is to write the data to the text log file "DbUpdateLog.txt". However, this logic was all placed in a class of its own so it should be easier for a developer to augment how and to where error and status messages should be saved and shown, as it is less likely that this class will change much. If the data instead should be saved to a data table just augment the CreateErrorLogFile message of this class.
See cDbUpdateHandler for more info about the container object.
Sample (Actual code)
Procedure CreateErrorLogFile tDbUpdateErrorArray aDbUpdateErrorArray
String sPath sFileName
Integer iCount iSize iCh
Boolean bExists
DateTime dtCurrentDateTime
Get Seq_New_Channel to iCh
If (iCh = DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin
Procedure_Return
End
Move (SizeOfArray(aDbUpdateErrorArray.iDbUpdateErrorArray)) to iSize
Decrement iSize
Get psDataPath of (phoWorkspace(ghoApplication)) to sPath
Get vFolderFormat sPath to sPath
Get psDbUpdateLogFile to sFileName
Move (sPath + sFileName) to sFileName
Move (CurrentDateTime()) to dtCurrentDateTime
Append_Output channel iCh sFileName
Writeln channel iCh ""
Writeln channel iCh "Database Updated Date & Time: " dtCurrentDateTime
Writeln channel iCh "Error: " (Character(09)) " Error Text:"
For iCount from 0 to iSize
Writeln channel iCh aDbUpdateErrorArray.iDbUpdateErrorArray[iCount];
(Character(09)) aDbUpdateErrorArray.sDbUpdateErrorArray[iCount]
Loop
Close_Output channel iCh
Send Seq_Release_Channel iCh
End_Procedure
Next Topic