Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter Class - some explanations please
Message
De
16/03/2003 03:45:06
 
 
À
11/03/2003 11:24:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00764286
Message ID:
00766277
Vues:
17
>CursorAttach Method
>The top description says "Attaches an existing cursor to the current ...".
>Q1 What does it mean to "attach" a cursor?

Attach means that the cursor will be associated with that particular CursorAdapter (CA) instance. If current buffering mode is "smaller" than CursorAdapter.BufferModeOverride then it is promoted to CursorAdapter.BufferModeOverride. If it is bigger then it is promoted up to the next optimistic buffering mode.
The CA instance handles all explicit and implicit calls to TABLEUPDATE and REQUERY functions for associated/attached cursor, all CA methods and events are fired on the instance as appropriate. When CA is destroyed, it closes attached cursor. Attempt to close the cursor may fail in the same way as USE IN may fail, but the CA instance is destroyed any way.

>Q2 What are the implications on (usage of) the specified cursor outside of the CursorAdapter instance to which it is "attached"?

It can be used as any other cursor, but buffering mode is limited to optimistic row or table buffering (the same way as for view) and cursor schema can not be changed. CursorAdapter exposes a set of properties that allow to customize the way TABLEUPDATE, REQUERY and some other operations on cursor are handled. Some of those properties have the same name and meaning as cursor's properties accessible thru CURSORSETPROP/CURSORGETPROP, those CA properties override same name properties for attached cursor (cursor's properties are not changed they are ignored and CA properties are taken into consideration until the cursor is detached). As mentioned above, CA methods and events are fired as appropriate.

>Under the "lInheritCursorProperties" parameter description is written "Specifies whether you wish to keep or discard the properties of the cursor or table being attached. ".
>Q3 What specific "properties is this referring to?

The following CA properties override the same properties for attached cursor: FetchMemo, FetchSize, MaxRecords, UseMemoSize, Prepared, CompareMemo, FetchAsNeeded, BatchUpdateCount, UpdateType, WhereType, SendUpdates, AllowSimultaneousFetch, Tables, KeyFieldList, UpdatableFieldList, UpdateNameList. Cursor's properties are not discarded (bad wording in help) they are ignored. If lInheritCursorProperties parameter is set to .T. then CA instance inherits those properties from attached cursor, values are copied from cursor's properties into correspondent CA properties.

>Under the "Remarks", first line, it says "A cursor or table can have only one instance of a CursorAdapter object attached to it...".
>Q4 Is the cursor or table 'attached TO the CursorAdapter' or is the CursorAdapter 'attached to the table or cursor'?

Either way is true, there is one to one association.

>Under the "Remarks", third paragraph, it says "Calling CursorAttach closes the currently attached cursor. To preserve the currently attached cursor, call CursorDetach first.".
>Q5 What does it mean to "preserve the currently attached cursor..."?

That means - if you don't want it to be closed.

>CursorDetach Method
>The top description says "Frees the currently attached cursor from the current instance of CursorAdapter.".
>Q6 What does "frees" mean?... What are the implications on the cursor (that is) detached?

Cursor is no longer associated with CA instance.

>Under the "Remarks", first line, it says "Visual FoxPro preserves all settings, such as buffering and so on, available to a normal cursor in the freed cursor..
>Q7 What 'settings' are 'preserved' ("and so on" doesn't really tell me)?

None of the cursor's (CURSORGETPROP/CURSORSETPROP) properties are changed.

>Q8 Is there any difference between a "normal cursor" and a "freed cursor"?

No, but VFP has many types of "normal" cursors: temp cursor, table, local view, remote view, SPT cursor.

>Under the "Remarks", second paragraph, it says "Visual FoxPro preserves all unsaved changes. For example, you do not need to call the TABLEUPDATE( ) function before detaching the cursor.".
>Q9 I interpret this to mean that I can later continue to work with the (detached) cursor as a normal cursor in every respect. Is this correct?

Yes.

>Q10 Is it reasonable to assume that the 'alias' of the detached cursor remains what it was as specified in the CursorAdapter 'Alias'?

Yes.

>BeforeCursorDetach Event
>Under the "Remarks", only line, it says "If the code in BeforeCursorDetach returns a value of False (.F.), the cursor does not detach, and any return values are ignored.".
>Q11 What is being referred to by "...any return values..."?

Please, disregard the part "and any return values are ignored".

Thanks,
Aleksey Tsingauz.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform