Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to release datasessions?
Message
From
07/04/2010 15:58:15
 
 
To
07/04/2010 15:20:38
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01459196
Message ID:
01459251
Views:
53
Thank you. I will save it and try next time I run into a problem.


>
>I used to run this to "Clean things up"
>
>A simple DO Z and you are ready to go.
>
>
>
>* Z.PRG
>* Visual FoxPro 6.0
>
>local lcCurDir
>PUBLIC glDEBUG
>
>wait wind nowa "Resetting developer environment..."
>
>CloseDataAll()				&& bxk 05.01.02
>
>on shutdown
>clear program()
>clear program
>clear events
>* probably not needed anymore
>clear read all
>clear all
>close all
>clear macros
>clear menu
>clear window
>clear
>
>set library to
>set classlib to
>set procedure to 
>
>on key
>on error
>on escape
>
>set help to
>* set resource to f:\devuti60\FOXUSER.DBF
>
>set clock status
>set status bar on
>
>lcCurDir = sys(5) + sys(2003)
>modi wind screen title lcCurDir + " - " + vers()
>_screen.fontname = "Courier New"
>_screen.fontsize = 10
>_screen.fontbold = .T.
>
>set defa to &lcCurDir
>
>set century on
>set debug on
>set deleted off
>set escape on
>set exact off
>set hours to 24
>set message to
>set optimize on
>set safety off
>set sysmenu to default
>set sysmenu on
>
>clear
>
>glDEBUG = .T.
>
>return
>
>*==============================================================================
>*!* PROCEDURE CloseDataAll
>*
>* Purpose:
>* This will close and revert all the open tables in all
>* the data sessions
>*
>* Special thanks again to Fletcher Johnson for this portion
>* of the reset code which was the winner of the $100 poker
>* chip contest from the Error Handling and Debugging session.
>*
>* Authors:
>* David Tansey
>* Fletcher Johnson - CIS 72647,1447
>*
>* From http://fox.wikis.com/wc.dll?Wiki~AppShutDown~VFP
>*
>********************************************************
>PROCEDURE CloseDataAll
>#define MAX_SESSIONS 200
>
>LOCAL ;
>	lnCurrentDataSession, ;
>	lnCurrentWorkArea, ;
>	lcErrorCode, ;
>	laFiles[1], ;
>	li
>	
>PRIVATE ;
>	plError
>
>plError = .F.
>
>lcErrorCode = ON( "error")
>ON ERROR plError = .T.
>
>
>FOR lnCurrentDataSession = 1 TO MAX_SESSIONS
>
>	SET DATASESSION TO ( lnCurrentDataSession )
>    
>	IF plError
>		
>		*-- An error occured, must not have
>		*-- any data in this datasession
>		plError = .f.
>
>	ELSE
>
>		*-- Ok, we have data here
>		
>		FOR li = 1 TO TXNLEVEL()	&& bxk 05.01.02
>			ROLLBACK	
>		ENDFOR		
>		
>		FOR lnCurrentWorkArea = 1 to AUSED( laFiles )
>		
>			SELECT (laFiles[lnCurrentWorkArea])
>			
>			IF CURSORGETPROP("BUFFERING") > 1
>				TABLEREVERT( .T.)
>			ENDIF
>			
>			USE && close the table
>			
>			plError = .F.
>			
>		ENDFOR
>	
>	ENDIF
>	
>ENDFOR
>  
>FLUSH
>  
>*-- Now reset the error handling code
>IF NOT EMPTY( lcErrorCode )
>  ON ERROR &lcErrorCode
>ELSE
>  ON ERROR
>ENDIF
>
>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform