Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Questions re Bob Lee's article on MySQL
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00638711
Message ID:
00638865
Views:
24
Hello Peter and Glen.

Pondering this question as you have, I came up with basically the same approach as Glen.
When the form was loaded, get your cursors, and all your form control would work just as they do now, (bound to the dbf's) No relation would be necessary, as the local cursors would only be populated with revelent records anyway.

One note, to Glen, to make a Client / Server cursor readwrite, you dont even need to send in the param to the sql statment. when using sqlexec, its there automaticaly. (unlike sql statments on vfp tables)

After you browse, and edit these records yould should have some way of sending back the cursors to the server, to commit your changs. Something like the mysave() command. but you do have to send your local cursors to the server.

You might also attempt this using a remote view. The code for keeping the updated cursor would be made for you...

Bob Lee



>Hi Peter,
>
>Nearly all you asked for is doable. If you are using VFP7.0 you do not have to do anything special with the cursor to make it readwrite other than adding the "readwrite" attribute to the SQL statement. There does not seem to be a need to relate files because the cursor sets you have retrieved are already those which are associated with the Owners cursor, there are NO other records in the local cursors.
>
>Form::Load
>
>create cursor c_Owners ( iOWNERS (x)...)
>create cursor c_Persons ( iOWNERS (x)...)
>create cursor c_Address ( iOWNERS (x)...)
>create cursor c_phones ( iOWNERS (x)...)
>create cursor c_Email ( iOWNERS (x)...)
>create cursor c_CrCard ( iOWNERS (x)...)
>
>
>The following is not how I would implement this in my own system but it demonstrates how an existing application such as yours could be made to adapt to C/S.
>
>
>Form::GetCursors
>
>SqlExec(nMySQL,'select * from OWNERS where iOWNERS = '+ tiOWNER,'cOwners')
>SqlExec(nMySQL,'select * from Persons where iOWNERS = '+ tiOWNER,'cPersons')
>SqlExec(nMySQL,'select * from Address where iOWNERS = '+ tiOWNER,'cAddress')
>SqlExec(nMySQL,'select * from Phones where iOWNERS = '+ tiOWNER,'cPhones')
>SqlExec(nMySQL,'select * from Email where iOWNERS = '+ tiOWNER,'cEmail')
>SqlExec(nMySQL,'select * from CrCard where iOWNERS = '+ tiOWNER,'cCrCard')
>
>*
>*  Since all controls are bound to Load event cursors
>*  We must populate those cursors with the current data from the back end
>*
>select c_owners
>zap
>append from (dbf('cOwners'))
>
>select c_Persons
>zap
>append from (dbf('cPersons'))
>
>select c_Address
>zap
>append from (dbf('cAddress'))
>
>select c_Phones
>zap
>append from (dbf('cPhones'))
>
>select c_Email
>zap
>append from (dbf('cEmail'))
>
>select c_CrCard
>zap
>append from (dbf('cCrCard'))
>
>
>
>I don't know how to lock a current record in a client server scenario other than by begin transaction / end transaction, which I think could be used when handling your updates.
>
>One of the only things not handled very well is full table browsing. It would be imprudent to use a grid or to use next prev for master record navigation. Client server is set orientated.
In the beginning, there was a command prompt, and all was well.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform