Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is this table open under a different alias
Message
From
24/01/2000 18:20:20
 
 
To
24/01/2000 18:03:48
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00321816
Message ID:
00321917
Views:
29
>>Without using AUSED, you would have to attempt a USE on the table and see if it fails (obviously with error handling). Not cool.
>
>Why not?

Because it's a kludge to write code that tried to disable an error handler temporarily and then (hopefully) restores it when done. Further, if the function got called from an object whose class has an Error method, this approach won't work.

The only robust way that I know of to accomplish it is to define a class to do it for you, and have that class contain an error method to deal with the issue. Something like:
FUNCTION IsOpenElsewhere( lcTable )
LOCAL loChecker, llResult
loChecker = CREATE( "IsOpenElsewhereChecker" )
llResult = loChecker.Check( m.lcTable)
RETURN m.llResult

DEFINE CLASS IsOpenElsewhereChecker AS RELATION
lError = .F.

FUNCTION Check( lcAlias)
USE &lcAlias IN 0
IF NOT THIS.lError
  USE IN ( m.lcAlias )
ENDIF
RETURN NOT THIS.lError
ENDFUNC

FUNCTION Error( p1, p2, p3)
THIS.lError = .T.
ENDFUNC

ENDDEFINE
-- Randy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform