I am using Visual FoxPro 8 Service Pack 1.
To duplicate what looks like a bug:
Create a dbc_AfterOpenTable() event procedure.
Put a SQL SELECT statement in there.
Select any fields FROM THE TABLE BEING OPENED,
into any destination (TO SCREEN, INTO CURSOR).
Result:
The SELECT statement causes the AfterOpenTable() to call itself infinitely.
Eventually FoxPro will give an error.
Isn't this a bug?
No. All dbc calls allow recursion.
You must cut the recursion:
PROCEDURE dbc_AfterOpenTable()
IF VARTYPE(M.g_dbc_AfterOpenTable_TABLENAME)=='U'
PUBLIC g_dbc_AfterOpenTable_TABLENAME
Select any fields FROM TABLENAME into any destination (TO SCREEN, INTO CURSOR).
RELEASE g_dbc_AfterOpenTable_TABLENAME
ENDIF
You can use ASTACKINFO() also, but the Mutex is more selective.
try this also:
PROCEDURE dbc_AfterOpenTable()
Select any fields FROM ALIAS() into any destination (TO SCREEN, INTO CURSOR).
ENDIF