tDbUpdateError - The Database Update Framework

See Also: Declaring Variables, Struct 

Purpose

tDbUpdateError is a structured type used by the cDbUpdateHandler class for logging errors that occurred during a database update.

 

Type Declaration

Struct tDbUpdateError

    Number nUpdateVersion

    Integer iError

    String sErrorText

    Integer iErrorLine

    Boolean bError

End_Struct

 

Struct Members

nUpdateVersion

The update version number.

iError

The error number.

 sErrorText

The error text.

iErrorLine

The error line in code.

bError

True if this was an error - false if a warning.

Syntax

Use cDbUpdateHandler.pkg

:

tDbUpdateError {variableName}

 

Declaring variables

To declare tDbUpdateHandler variables, use the name of the type (tDbUpdateError) followed by the variable name.

tDbUpdateError[] DbUpdateErrorArray

See struct variables for more details of instantiating struct types.


Example

    // Called once when the update begins.

    Procedure OnErrorWriteHeader_DataTable DateTime dtUpdateStart

        Open MyLogTable

        Move dtUpdateStart to MyLogTable.UpdateStart

        Saverecord MyLogTable

    End_Procedure


    // Called once after all updates have finished if pbQuickWrite=False. If pbQuickWrite=True it is called once for each error.

    Procedure OnErrorWriteRow_DataTable tDbUpdateError[] DbUpdateErrorArray

        Integer iSize iCount

        Open MyLogTable

        Move (SizeOfArray(DbUpdateErrorArray)) to iSize

        Decrement iSize

        For iCount from 0 to iSize

            Clear MyLogTable

            Move DbUpdateErrorArray[iCount].iError to MyLogTable.ErrorNo

            Move DbUpdateErrorArray[iCount].sErrorText to MyLogTable.ErrorText

            SaveRecord MyLogTable

        Loop

    End_ProcedureEnd_Procedure



Note that these are send automatically by the cDbUpdateHandler class logic, if pbUseDataTable = True.