Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Attaching a cursor to a CA
Message
 
 
To
19/05/2017 17:07:04
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01651181
Message ID:
01651247
Views:
45
>>Let me describe what I was trying to do (initially) and how/why I changed my mind.
>>
>>I have a procedure where the user selects any number of records in a Parent table. Then, in the WHILE look, the program has to update many Child tables (adding, changing, deleting). Initially I wanted to have each Child table records of all Parent records. So that I would have just ONE TableUpdate(). This would be nice but, I decided, not practical.
>>1. For any Child table, it is very difficult to get All records for All Parent records. So I thought that, as the code goes from one Parent record to another, I would "get/add" records from the Child table. But this is not easy. Since, I found, that you cannot add records to the CA cursor incrementally. It has to be done one time.
>>2. The other problem is that the resulting CA cursor (or any Child table) can be so big that it may be a problem to update the DB table (in TableUpdate()). For example, it theory, a Child table could end up having, say 10,000 rows. I have never done updates from CA cursors that big.
>>3. So I decided that each Parent record will be processed, Child tables will be updated, TableUpdate() for the Parent and Child will be fired.
>>4. Then the Parent pointer will go to the next record.
>
>OK, the whole thing makes sense now. Except "you cannot add records to the CA cursor incrementally" - with buffering at 5, you should be able to do that, as long as there's no tableupdate() before you're completely done.

I didn't say it correctly; of course you can add new records to the CA cursor incrementally. I meant you cannot retrieve more records from the DB incrementally. Here is an example. You create a CA object and call the CursorFill() method to get records of customer "ABC". Then, you make some changes to these records (of customer "ABC"). Now, say you want to add to the CA cursor records of the customer "CBS", leaving all the records of customer "ABC" in the cursor and not yet sent to the DB (via TableUpdate()). So this is what the difficulty: how to retrieve into the existing CA cursor more records from the base DB table.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform