|
dberror
|
|
Full name
|
pfc_u_dw.dberror
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event dberror()
|
Name
|
Datatype
|
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.
//////////////////////////////////////////////////////////////////////////////
// Rev. History Version
// 5.0 Initial version
// 5.0.02 Suppress error messages until after a rollback has been performed
// 6.0 Enhanced to use new dberrorattrib to support all error attributes.
// 6.0 Enhanced to support Transaction Management by other objects
// 6.0 Enhanced to send notification to the SqlSpy service.
//////////////////////////////////////////////////////////////////////////////
// Copyright © 1996-1999 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
string ls_message
string ls_sqlspyheading
string ls_sqlspymessage
string ls_msgparm[1]
powerobject lpo_updaterequestor
n_cst_dberrorattrib lnv_dberrorattrib
// 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