Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter Question
Message
De
25/04/2005 13:55:14
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01008137
Message ID:
01008174
Vues:
19
Kevin,

>1) When the object oCursor is destroyed, the table closes. Any way
>to make it persist?

By default, the cursor's life is tied to the object reference remaining in scope. When the CA object is gone, so is the cursor. However, for the type of situation you want, you can use the oCA.CursorDetach() method to "unplug" and persist the cursor.

>2) If the table can be persisted after the CA class is destroyed, can/how
>are changes submitted back to the data source?

The inverse of the CursorDetach() method is oCA.CursorAttach(). I have not yet experimented much with it, but will very soon. Assuming that the cursor you are attaching has buffered and perhaps updated data in it, it should be able to update the backend data source -- but as I said, I have not yet tested that assumption.

>3) How would you impliment this? Obviously the structure required for each call
>to this code might be different. It seems inifficient to have to create a PRG
>for each table I want ot access.

Create a top-level subclass of CursorAdapter that includes capabilities you want for all your cursoradapter instances. Then, subclass from that as needed. You don't have to have a separate PRG for each, but can combine them together either in one or more PRGs or in VCXs.

>4) How would you use the CA in a multi tier environment? If I create a class
>based on session, with this code inside it, the resulting cursor is then in a
>different session. We don't use DBC's. All tables are free tables.
>

If you mean multi-physical tiers, you obviously will have to convert the resulting cursor into another format, such as XML, to pass it between tiers. For use in a logically-tiered, but physically all-in-one EXE, you have many more options for passing things around (not really passing a cursor around, but making it available elsewhere in your code).

If you are using the Session class to isolate your CA calls (and the resulting cursor), you of course must do some fancy footwork to make them available elsewhere in your program, but you don't have to use Session all the time.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform