Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SDT and Error Handling
Message
 
 
To
12/05/2005 14:37:25
General information
Forum:
Visual FoxPro
Category:
Stonefield
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01013546
Message ID:
01014077
Views:
31
I think you are confusing the RETURN 'Retry' with just reissuing the RETRY command in your Error handler. When you return the string 'Retry' from the error handler, this value really goes no where. When you issue the RETRY command, then the line that triggered the error tries to execute again. Is that what you are trying to do (retry execution of the line that errored)?

>SDT 6.2a
>We are redesigning our open table method to create a table if it does not exist. That is working correctly, however, the table is not opened because 'Retry' is not being captured in the dbcxmmgr error method.
>
>We open a table as so:
>
>
>IF !USEFILE('lbridges','dbSystem','BRIDGEKEY','','')
>   *--Error message
>
>The new usefile program:
>
>PARAMETERS ufile, udbc, uorder, ualias, uparm1, uparm2, uparm3
>
>PRIVATE xreturn, udir
>xreturn = .F.
>udir = ''
>
>IF EMPTY(ufile)
>	WAIT WINDOW 'Error in USEFILE.PRG - File name is missing.'
>	RETURN xreturn
>ENDIF
>IF '.' $ ufile
>	ufile = LEFT(ufile,AT('.',ufile)-1)
>ENDIF
>
>IF EMPTY(udbc)
>	udbc = ''
>ELSE
>
>	*---If the udbc contains a '\' assume it is a directory name.
>
>	IF OCCURS('\', udbc) > 0
>		udir = udbc
>		IF RIGHT(udir,1) <> '\'
>			udir = udir + '\'
>		ENDIF
>	ENDIF
>	
>ENDIF
>
>IF EMPTY(ualias)
>	ualias = ''
>ENDIF
>
>uexclu = .F.
>
>IF !EMPTY(uparm1)
>	DO setparms WITH uparm1
>ENDIF
>IF !EMPTY(uparm2)
>	DO setparms WITH uparm2
>ENDIF
>IF !EMPTY(uparm3)
>	DO setparms WITH uparm3
>ENDIF
>
>* Set up error handler
>ON ERROR DO ErrorHandler WITH ERROR(), MESSAGE(), LINENO()
>
>* Open the table
>IF !EMPTY(udir)
>	xreturn = oMeta.oSDTMgr.OpenTable(udir+ufile, uorder, uexclu, ualias)
>ELSE
>	IF !EMPTY(udbc)
>		oMeta.SetDatabase(udbc)
>	ENDIF
>	xreturn = oMeta.oSDTMgr.OpenTable(ufile, uorder, uexclu, ualias)
>ENDIF
>
>ON ERROR DO errors WITH PROGRAM()
>
>RETURN xreturn
>
>*---------------------------------------------------------------------------
>PROCEDURE setparms
>PARAMETERS xparm
>
>DO CASE
>CASE TYPE('xparm') <> 'C'
>
>CASE UPPER(xparm) = 'EXCLU'
>	uexclu = .T.
>ENDCASE
>
>RETURN
>
>*---------------------------------------------------------------------------
>PROCEDURE ErrorHandler
>PARAMETERS tnError, tcMessage, tnLineno
>
>DO CASE
>
>*File "<file>" does not exist.
>
>CASE tnError = 1 AND NOT EMPTY(oMeta.oSDTMgr.cAlias)
>	oMeta.oSDTMgr.Update(oMeta.oSDTMgr.cAlias)
>
>	RETURN 'Retry'
>	
>* If an index error occurred (5 = record out of range, 19 = index doesn't match
>* DBF, 20 = record not in index, 23 = index expression too big, 26 = table
>* isn't ordered, 112 = invalid key length, 114 = index file doesn't match DBF,
>* 1124 = key too big, 1683 = tag not found, 1707 = structural CDX not found,
>* 1567 = primary key invalid), reindex the table.
>
>CASE INLIST(tnError, 5, 19, 20, 23, 26, 112, 114, 1124, 1683, 1707, 1567) AND NOT EMPTY(oMeta.oSDTMgr.cAlias)
>	oMeta.oSDTMgr.Reindex(oMeta.oSDTMgr.cAlias)
>
>	RETURN 'Retry'
>
>* If the table or memo is corrupted (15 = not a table, 41 = memo missing or
>* invalid, 2091 = table has become corrupted), repair it.
>
>CASE INLIST(tnError, 15, 41, 2091) AND NOT EMPTY(oMeta.oSDTMgr.cAlias)
>	oMeta.oSDTMgr.Repair(oMeta.oSDTMgr.cAlias)
>
>	RETURN 'Retry'
>ENDCASE
>
>RETURN ''
>
>In the case when the table does not exist, the below runs (the table is created as it should be):
>
>CASE tnError = 1 AND NOT EMPTY(oMeta.oSDTMgr.cAlias)
>	oMeta.oSDTMgr.Update(oMeta.oSDTMgr.cAlias)
>
>	RETURN 'Retry'
>
>however, the error routine of dbcx mgr does not capture the 'Retry' sent back to it and so the table is never opened:
>
>			if left(lcError, 3) = 'DO ' or '=' $ lcError   && <--this is true
>				&lcError                               && <--this runs (retry not captured)
>				lcReturn = ccMSG_CONTINUE && <--changed to continue, need it retry
>
>			else
>				lcReturn = &lcError
>			endif left(lcError, 3) = 'DO ' ...
>	endcase
>
>
>Any ideas?
>
>TIA!
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform