Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Questions re Bob Lee's article on MySQL
Message
From
29/03/2002 00:12:45
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00638711
Message ID:
00638825
Views:
29
>B. Cursor columns
> 1. Create cursor in Load event
> 2. Append from record retrieved
> 3. pass updates to SQL cursor for update


Thanks, Glenn.

So let's say I want to use approach B with my Owner Update form where I currently have 6 local tables. Can I download six cursors and set relations between them to mimic the old tables? Of course, the data source for the various form fields would be set to the cursor field names.

Here is some test code:
lparameter	tiOWNERS

close data all

select * from OWNERS where OWNERS.iOWNERS =  tiOWNERS into cursor curOWNERS nofilter
select OWNERS
use
select curOWNERS
do COPYCURS
index on curOWNERS.iOWNERS tag iOWNERS
set relation to

select * from PERSON where PERSON.iOWNERS =  tiOWNERS into cursor curPERSON nofilter
select PERSON
use
select curPERSON
do COPYCURS
set relation to curPERSON.iOWNERS into curOWNERS

select * from ADDRSS where ADDRSS.iOWNERS =  tiOWNERS into cursor curADDRSS nofilter
select ADDRSS
use
select curADDRSS
do COPYCURS
set relation to curADDRSS.iOWNERS into curOWNERS
I left out the other tables for the sake of brevity. COPYCURS is a routine that makes a read-write cursor. I tested this and it seems to work fine. SET shows all the expected relationships and I can modify the records.

Considering just one Owner record, I would have:

curOWNERS 1 record
curPERSON 1-2 records (typically)
curADDRSS 1-2 records
curPHONES 1-3 records
curEMAIL 1-2 records
curCRCARD 1-2 records

Then the user can browse around to the different child records, make changes as needed, and then update, right? The form would look just the way it does now. In this case they could not move off the parent OWNERS record but "one step at a time."

To further complicate this scenario, suppose when I go to update I want to lock the OWNERS record in MySQL, download just the OWNERS record a second time, check OWNERS.tUpdated field against the one that I previously downloaded to make sure there have not been any intervening changes, then return all six R-W cursors for update, and finally unlock the OWNERS record.

Does all this sound do-able? Am I on the right track or is there a simpler way?

Peter
Peter Robinson ** Rodes Design ** Virginia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform