Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File is in use
Message
From
18/12/2004 09:40:19
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00970099
Message ID:
00970312
Views:
17
If two objects in the same datasession need comingled access to the same alias, I'd say you have a design problem. Maintaing and restoring record pointers and orders (how about filters, too?), is somewhat outdated.

One simple, but pretty safe, idea is using custom aliases that have semantic meaning based on the use case. For example, say one object uses the Customer table for lookup purposes and another is performing some summary analysis. The first could specify an alias of Customer_Lookup_, as in:

USE Customer AGAIN ALIAS Customer_Lookup_ IN SELECT("Customer_Lookup_")

and similarly for the other object. Obviously, a generic UDF could also be used.

-- Randy

>I don't know how it is possible to construct resuseable/loosely coupled classes and use static alias names.
>
>In the example below, if the alias "per" is expected to be used by an object, - what if another object is instantiated in the same datasession that wants to use the same table ? It means that objects have to be aware of other objects that want the same alias - not very reuseable !!
>
>I always use temporary alias names -
>eg.
>
>SELECT 0
>USE mytable AGAIN
>lcMyAlias = ALIAS()
>
>SELECT * ;
>FROM (lcMyAlias) ......
>
>Is this common pratice or are people sharing a cursor between objects and carefully taking note to restore the record pointer/order etc. etc. ?
>
>>IF the table to be used is already open in another workarea than the current one, it will be opened in a new workarea with a different alias. That could be a problem if you were expecting it to be a known alias name. At least that is how it works in VFP6. Wouldn't it be better if you are concerned about whether the table is already open us use something like :
>>
>>
IF !USED("PER")
>>     USE PER ALIAS PER IN 0
>>ENDIF
>>SELECT PER
Previous
Reply
Map
View

Click here to load this message in the networking platform