sqlpreview


pfcmain.pbl   >   pfc_u_dw   >   sqlpreview   

Full name pfc_u_dw.sqlpreview
Access public
Extend of
Return value
Prototype event sqlpreview()

Name Datatype
No Data

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.
//						Provide selective updates, inserts, and deletes. 
//////////////////////////////////////////////////////////////////////////////
//	Rev. History	Version
//						5.0   Initial version
//						6.0 	Only perform the requested SQL (insert, update, delete) statements.
//////////////////////////////////////////////////////////////////////////////
//	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.
//////////////////////////////////////////////////////////////////////////////
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	return

// 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
No Data

     
Name Owner
powerobject.classname powerobject
datawindow.setsqlpreview datawindow
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.pos systemfunctions
pfc_u_dw.of_MessageBox pfc_u_dw
pfc_n_cst_sqlspy.of_sqlpreview pfc_n_cst_sqlspy

     
Full name
demopfc

     
Name Scope
No Data