of_savehistorytofile


pfcutil.pbl   >   pfc_n_cst_sqlspy   >   of_savehistorytofile   

Full name pfc_n_cst_sqlspy.of_savehistorytofile
Access public
Extend of integer
Return value integer
Prototype public function integer of_savehistorytofile()

Name Datatype
No Data

Name Datatype
li_filenumber integer
li_rc integer
ls_filename string
ls_path_filename string
TITLE string

public function integer of_savehistorytofile ();//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_SaveHistoryToFile ()
//
//	Access:  		public
//
//	Arguments: 		
//
//	Returns:  		integer
//						Returns 1 if it succeeds and -1 if an error occurs.
//						
//	Description:  	Saves the current history to a file.
//						Opens the GetFileSaveName dialog window, gets a 
//						filename, and allows for the saving of the SQL history to 
//						the file.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.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.
//
//////////////////////////////////////////////////////////////////////////////

constant string	TITLE='Save SQLSpy File'
string	ls_path_filename
string	ls_filename
integer	li_rc
integer	li_filenumber

SetPointer(HourGlass!)

//Get the filename
li_rc = GetFileSaveName  (TITLE, ls_path_filename, ls_filename, & 
				'SQL', 'SQL Files (*.SQL), *.SQL' )

If li_rc > 0 Then
	
	If FileExists (ls_path_filename) Then
		//Existing file has been found
		If of_MessageBox ('pfc_sqlspy_replacefile', TITLE, &
			'Replace existing file '+ls_path_filename, &
			Question!, YesNo!, 1) = 2 Then
			//Do not replace the file
			Return 1
		End If
	End If
	
	//Write the history to the file
	SetPointer (HourGlass!)
	li_filenumber = FileOpen(ls_path_filename, StreamMode!, Write!, LockWrite!, Replace!)
	If li_filenumber > 0 Then
		FileWrite (li_filenumber, is_history)	
		FileClose (li_filenumber)
	End If
	
End If

Return li_rc

end function

     
Name Owner
pfc_w_sqlspy.cb_save.clicked cb_save

     
Name Owner
systemfunctions.fileclose systemfunctions
systemfunctions.fileexists systemfunctions
systemfunctions.fileopen systemfunctions
systemfunctions.filewrite systemfunctions
systemfunctions.getfilesavename systemfunctions
systemfunctions.setpointer systemfunctions
pfc_n_base.of_messagebox pfc_n_base

     
Full name
No Data

     
Name Scope
No Data