Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modifying returned cursor structures
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00612134
Message ID:
00612181
Views:
37
>>>>I have a case where the sql to the backend returns a structure slightly different than what I want. What I want to do is alter the column(s) of the result set to the datatype that I want. I have one of several ways that I can do this: 1 - create the cursor structure I want and append the result set into that structure, 2 - open the dbf() again in new work area and close it in the first and then alter the structure, 3 - figure a way to set the read only attribute of the cursor to read-write and alter it. #1 is okay, except I want to be someone generic in what I am doing. #2 works but truncates long field names. #3 is what I want but I can't figure out how to do it with the cursor open and not running a dos attrib command. I know it sounds weird, but it does have its place. Any ideas?
>>>
>>>Only #1 will work with long field names. AFAIK, #3 cannot be done. Anyway even if it could be done ALTER command would truncate field names because it still a cursor.
>>
>>Actually, I have figured a way to do #4 :), create a cursor on the fly and build it dynamically with the info from the selected cursor changing the field types I need to the types I want, appending the records and and the closing the initial cursor re-aliasing my new cursor and returning a cursor in the stead of the first one. Horrible for large data sets but a defendable workaround for smaller data sets.
>
>I don't see how it's different from the #1.
It really isn't except that when I typed up #1 I wasn't thinking dynamically, I was thinking statically and manually creating the cursor structure in my code. The dynamic approach is what is different and only relates to my thought process (it just didn't spill out onto what I was typing :))
Previous
Reply
Map
View

Click here to load this message in the networking platform