Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Altering a CUSOR's structure
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00062738
Message ID:
00062870
Views:
46
>>So far as I'm aware you can't other than getting the name of the temporary table with DBF() then USEing the table again in another area. If you have dependent forms, grid controls, etc on that cursor though you may well end up with inconsistencies between buffered data and data actually stored.
>>
>>If you know that you want a particular structure in a cursor then modify the SQL that creates it in the first place. You can create place holders for any of the standard field types in SQL.
>>
>>i.e. Select *, 0.00 as NewNumber, Space(10) newindex, date() as newdate from fred into cursor jim
>>
>>
>>>Does anyone know how to alter a cursor after it is created with CREATE CURSOR?
>>>I have found ALTER TABLE, but no ALTER CURSOR.
>>> Thanks.
>I have tried to get the DBF() but, there is no guarantee that the the DBF() of a cursor exists as a file. I also got a 'Table in Use' error when attempting to ALTER TABLE the USEd AGAIN version.
>I was playing with the idea of altering the structure of a cursor based on run-time information. I guess I'll just have to use CREATE/ALTER TABLE and handle clean up myself or forget about it.
> Thank you for the response.

A cursor is temporary and disappears as soon as it is closed. To alter any table structure you have to have exclusive use. So, if you have SET EXCLUSIVE ON before you issue the command to create it, you would have exclusive access to the cursor. The ALTER TABLE will work. AFter you create the cursor you can return the EXCLUSIVE setting back to the way it was -- store the original value using SET("EXCLUSIVE"). Since you are using a cursor, there is no reason not to have exclusive access to it, even in multi-user environment. Just the use the DBF() function to get its actual name.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform