|
dberror
|
|
Full name
|
pfc_n_ds.dberror
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event dberror()
|
Name
|
Datatype
|
lb_pfcsaveprocess
|
boolean
|
lnv_dberrorattrib
|
n_cst_dberrorattrib
|
lpo_updaterequestor
|
powerobject
|
ls_message
|
string
|
ls_msgparm
|
string[1]
|
ls_sqlspyheading
|
string
|
ls_sqlspymessage
|
string
|
lw_parent
|
w_master
|
event dberror;//////////////////////////////////////////////////////////////////////////////
//
// Event: dberror
//
// Description:
// Display messagebox that a database error has occurred.
// If appropriate delay displaying the database error until the appropriate
// Rollback has been performed.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
w_master lw_parent
boolean lb_pfcsaveprocess=False
string ls_message
string ls_msgparm[1]
string ls_sqlspyheading
string ls_sqlspymessage
powerobject lpo_updaterequestor
n_cst_dberrorattrib lnv_dberrorattrib
// Construct the error message.
ls_message = "A database error has occurred.~r~n~r~n~r~n" + &
"Database error code: " + String (sqldbcode) + "~r~n~r~n" + &
"Database error message:~r~n" + sqlerrtext
// Set the error attributes.
lnv_dberrorattrib.il_sqldbcode = sqldbcode
lnv_dberrorattrib.is_sqlerrtext = sqlerrtext
lnv_dberrorattrib.is_sqlsyntax = sqlsyntax
lnv_dberrorattrib.idwb_buffer = buffer
lnv_dberrorattrib.il_row = row
lnv_dberrorattrib.is_errormsg = ls_message
lnv_dberrorattrib.ipo_inerror = this
//If available trigger the SQLSpy service.
If IsValid(gnv_app.inv_debug) Then
If IsValid(gnv_app.inv_debug.inv_sqlspy) Then
//Create the heading and message for the SQLSpy.
ls_sqlspyheading = 'DBError - ' + this.ClassName() + '(' + string(row) + ')'
ls_sqlspymessage = "Database error code: " + String (sqldbcode) + "~r~n" + &
"Database error message: " + sqlerrtext
//Send the information to the service for processing.
gnv_app.inv_debug.inv_sqlspy.of_sqlSyntax &
(ls_sqlspyheading, '/*** ' + ls_sqlspymessage + ' ***/')
End If
End If
// Determine if Transaction Management is being performed by another object.
If IsValid(ipo_updaterequestor) Then
lpo_updaterequestor = ipo_updaterequestor
Else
// Determine if the window is in the save process.
This.of_GetParentWindow(lw_parent)
If IsValid(lw_parent) Then
If lw_parent.TriggerEvent ("pfc_descendant") = 1 Then
If lw_parent.of_GetSaveStatus() Then
lpo_updaterequestor = lw_parent
End If
End If
End If
End If
If IsValid(lpo_updaterequestor) Then
// Suppress the error message (let the UpdateRequestor display it).
// MetaClass check, Dynamic Function Call.
lpo_updaterequestor.Dynamic Function of_SetDBErrorMsg(lnv_dberrorattrib)
Else
// Display the message immediately.
If IsValid(gnv_app.inv_error) Then
ls_msgparm[1] = ls_message
gnv_app.inv_error.of_Message ('pfc_dwdberror', ls_msgparm, &
gnv_app.iapp_object.DisplayName)
Else
of_Messagebox ("pfc_dberror", gnv_app.iapp_object.DisplayName, &
ls_message, StopSign!, Ok!, 1)
End If
End If
return 1
end event