Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Zap/Dele All - no packing
Message
De
05/03/2016 11:12:32
 
 
À
03/03/2016 16:46:37
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01632301
Message ID:
01632581
Vues:
97
Actually this does not surprise me. The first USE statement is looking for an already open occurrence of Bookings with the SELECT() function, if found, it returns the work area it is in, otherwise it returns 0. Therefore the first statement opens the Bookings table and assigns the Alias "muh" in a shared mode. Now, in the second statement the again looks for the Bookings table that could be open with the alias of "Bookings", but it is not, the table is actually open as "muh". So the SELECT function returns a 0, and the Bookings table is attempted to be open again, but exclusive. But it can not because it is open in another work area as "muh". therefore the error occurs. The use of SELECT in the IN clause will only work to reopen an existing table using the known alias.

this would work thou
USE bookings IN (SELECT("Bookings")) ALIAS muh
USE bookings IN (SELECT("muh")) EXCLUSIVE
But this would generally never occur in my code by design. But then again, I rarely need to open a table exclusive in a client application. As in the original example, I would have done a DELETE ALL in shared mode, and then create a method that recycles those deleted (RECALL) record when needed, or else INSERT if none are found.

IMO

>try
>
>USE bookings IN (SELECT("Bookings")) ALIAS muh
>USE bookings IN (SELECT("Bookings")) EXCLUSIVE
>*boom
>
>
>even better
>
>USE bookings IN (SELECT("Bookings")) 
>USE bookings IN (SELECT("Bookings")) AGAIN ALIAS muh
>USE bookings IN (SELECT("Bookings")) EXCLUSIVE
>*boom
>
>
>we do not talk datasessions and concurent use
>
>and, for your example
>
>SELECT SELECT("Bookings")
>USE bookings EXCLUSIVE
>
>
>will work with SELECT before USE. Even five char smaller code
>
>[gdr]
>
>>I am sure this must have been pointed out already. But, try placing a SELECT Bookings after the USE statement. If there is a table already in the current work area, then the Booking table will be opened in the next unused work area.
>>
>>Also, as a standard practice, I generally use the statement
>>
>>USE bookings IN (SELECT("Bookings")) EXCLUSIVE
>>SELECT Bookings
>>
>>So if the table is already open in another work area, then it will be reopened in the same work area.
>>
>>
>>
>>>
>>>SET SAFETY OFF
>>>SET EXCLUSIVE on
>>>USE bookings IN 0 EXCLUSIVE &&I have tried it with and without the exclusive clause. Makes no difference.
>>>DELETE ALL
>>>PACK
>>>IF ISEXCLUSIVE( ) &&Just to check if there is exclusivity. returns .f. each time - no matter what I change around in the code.
>>> MESSAGEBOX('Table opened exclusive')
>>>ELSE
>>>  MESSAGEBOX('Not opened exclusively')
>>>ENDIF
>>>SET EXCLUSIVE OFF
>>>SET SAFETY ON
>>>
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform