|
sqlpreview
|
|
Full name
|
pfc_n_ds.sqlpreview
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event sqlpreview()
|
Name
|
Datatype
|
l_buffer
|
dwbuffer
|
l_request
|
sqlpreviewfunction
|
l_sqltype
|
sqlpreviewtype
|
li_rc
|
integer
|
ls_sqlsyntax
|
string
|
event sqlpreview;//////////////////////////////////////////////////////////////////////////////
//
// Event: SQLPreview
//
// Description: Allow for SQLSpy service
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 6.0 Only perform the requested SQL (insert, update, delete) statements.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
integer li_rc
string ls_sqlsyntax
sqlpreviewfunction l_request
sqlpreviewtype l_sqltype
dwbuffer l_buffer
//Check the arguments.
If IsNull(sqltype) or IsNull(sqlsyntax) or IsNull(buffer) Then
//There is nothing to process.
Return
End If
// Only perform the requested SQL (insert, update, delete) statements.
If (sqltype = PreviewSelect!) Or &
(sqltype = PreviewInsert! And Pos(is_updatesallowed,'I')>0) Or &
(sqltype = PreviewUpdate! And Pos(is_updatesallowed,'U')>0) Or &
(sqltype = PreviewDelete! And Pos(is_updatesallowed,'D')>0) Then
// Allow the continuation of the SQL statament.
Else
// Stop this SQL statement from being executed.
// Return 2 - Skip this request and execute the next request.
Return 2
End If
//If available trigger the SQLSpy service.
If IsValid(gnv_app.inv_debug) Then
If IsValid(gnv_app.inv_debug.inv_sqlspy) Then
ls_sqlsyntax = sqlsyntax
l_request = request
l_sqltype = sqltype
l_buffer = buffer
//Send the information to the service for processing.
li_rc = gnv_app.inv_debug.inv_sqlspy.of_sqlpreview &
(this.ClassName(), l_request, l_sqltype, ls_sqlsyntax, l_buffer, row)
If li_rc = 1 or li_rc = 2 Then
// 1 Stop processing of all entries.
// 2 Skip this request and execute the next request.
Return li_rc
Else
// Normal processing.
If ls_sqlsyntax <> sqlsyntax Then
//The sqlsyntax was inspected and changed by the user.
//Update the SQL to the new syntax.
If this.SetSQLPreview (ls_sqlsyntax) = 1 Then
Return
Else
// An error was encountered on the Modified SQLStatement
of_Messagebox ('pfc_sqlpreview_error', 'SQLSpy on SQLPreview', &
'An error was encountered with the following SQL:~r~n~r~n'+ &
ls_sqlsyntax, Information!, Ok!, 1)
End If
End If
End If
End If
End If
end event
Name
|
Owner
|
powerobject.classname |
powerobject
|
datastore.setsqlpreview |
datastore
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
pfc_n_ds.of_messagebox |
pfc_n_ds
|
pfc_n_cst_sqlspy.of_sqlpreview |
pfc_n_cst_sqlspy
|