Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6 How to detect a table in use by views
Message
 
 
To
05/10/2004 04:36:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00948339
Message ID:
00948882
Views:
17
>>Hi
>>
>>>That's why you need an error trapping procedure. That's basically the only way to find, if the table could be opened excusively or not.
>>
>>I just gave your code a try but it seems that the class/form takes the error responsibility so the following line raises an error in the CodeBook framework rather than the error number being assigned to lnErr=ERROR()
>>
>> USE (m.tcTable) AGAIN &tcMode IN 0 ALIAS (m.tcAlias)
>>
>>Please advise, how can I let your function handle the error rather than passing it up he heirarchy?
>
>
>Bhavbhuti,
>I checked the code and it already have bugs in itself (sorry Nadya). ie:
>
>if !used(m.tcAlias) ...
>
>Is never a guarantee that table is not in use (Nadya remember alias might not be the same as tablename). Plus table might be in use with or w/o same alias name in another session. Code not looping sessions if I didn't miss it.
>
>use (m.tcTable) again &tcMode in 0 alias (m.tcAlias)
>
>Having tcMode as EXCLUSIVE doesn't guarantee you opened it in exclusive mode. It might be opened as shared and no error shows up (bug,feature?). ie:
>
>use employee shared
>use employee again exclusive in 0 alias e1
>? Isexclusive('employee'), IsExclusive('e1')
>
>"AGAIN" there is introducing an implicit logical error that you can't catch w/o checking.
>
>Cetin

Hi Cetin,

I think, you're right. This program has several flows: 1) The other table could be already opened with the passed alias;
2) The table could be already opened in shared mode and it would not be opened exclusive even using EXCLUSIVE keyword (we once were beat by this problem already).

I have a slightly different program called UseTble. This program does use in select(m.tcAlias) at the top, so it always closes the table already opened by passed alias. I do not remember, if that is the only difference in these two programs.

I guess, one day I would need to re-write it.

Also back to original question - AFAIK, the Error method of form/class has precedance to ON ERROR. While ago I saw an interesting discussion regarding this issue between Doug Henning and Mike Asherman, I'll try to find that thread later.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform