Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursoradapter and Private Datasession Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00821076
Message ID:
00822313
Vues:
27
Hi Aleksey

I finally tracked down the source of the problem. I discovered that "MultiLocks" was turned off in the forms with private datasessions which caused the cursorattach method to fail. In forms without private data sessions "Multilock" was on so everything worked fine.

This was hard to find since it did not trigger any kind of error or warning. It seems to me that some kind of message should have been trigger warning me that "multilocks" for turned off

Thanks,
Simon White


>Hi Aleksey
>
>I am using the following code in my Cursorfill Method:
>
>
>LPARAMETERS luseCursorSchema, noData, Options, Source
>NoDefault
>Local llReturn,loError
>With This
>   Try
>      If .CursorStatus!=0
>         Use In (.Alias)
>      EndIf
>      If .cTagDir="A"
>         USE (.cTable) In 0 Again Alias (.Alias) Order Tag (.cTag) Ascending
>      Else
>         USE (.cTable) In 0 Again Alias (.Alias) Order Tag (.cTag) Descending
>      EndIf
>      llReturn=.CursorAttach(.Alias)
>   Catch To loError
>       .oBizObj.cErrorMsg=loError.Message
>       llReturn=.N.
>   EndTry
>EndWith
>Return llReturn
>
>
>This code was based on code you supplied when I was looking for a way to use DBF tables without the speed penalty of creating the associated cursors and indexes normally associated with the Cursoradpter class.
>
>The code opens the table but the cursorstatus remains 0 for tables open in another work area or open using a different alias. However, the cursorattach method works correctly. No errors are generated but the expected functionality fails.
>
>Simon
>
>
>>>Hi
>>>
>>>I use forms with private datasessions. However, since the forms can be opened multiple times I now have a problem using CursorAdapters because there can only be one cursoradapter object attached to a cursor. So the cursorattach function fails on any table previously opened in the 1st form.
>>>
>>>Sometimes I open a table in a form again using another alias but this table also cannot have a cursoradpater attached to it.
>>>
>>>It appears that the only solution is to detach the cursoradapter from one table and attach it to another but this is a pain with multiple forms using private datasessions.
>>>
>>>Is there some other solution? I was hoping that you could attach a cursoradapter to each open table in all the open forms.
>>>
>>>Thanks
>>>Simon
>>
>>
>>Hi Simon,
>>
>>Could you post a simple repro for your scenario?
>>It is possible to have one CursorAdapter per cursor, I don't have any problem with the following code:
>>
>>
>>CLOSE DATABASES all
>>clear
>>SET MULTILOCKS ON
>>
>>CREATE table foo1 (f1 I)
>>USE
>>
>>USE foo1 SHARED
>>
>>USE foo1 IN 0 ALIAS foo2 AGAIN
>>
>>oca1=CREATEOBJECT("CursorAdapter")
>>oca2=CREATEOBJECT("CursorAdapter")
>>
>>?oCA1.CursorAttach("foo1")
>>?oCA2.CursorAttach("foo2")
>>
>>?oCA1.CursorStatus,oCA1.Alias,GETCURSORADAPTER(oCA1.Alias),DBF(oCA1.Alias)
>>?oCA2.CursorStatus,oCA2.Alias,GETCURSORADAPTER(oCA2.Alias),DBF(oCA2.Alias)
>>
>>oSess=CREATEOBJECT("Session")
>>SET DATASESSION TO oSess.DataSessionId
>>SET MULTILOCKS ON
>>oca3=CREATEOBJECT("CursorAdapter")
>>
>>USE foo1 IN 0 ALIAS foo3 AGAIN SHARED
>>?oCA3.CursorAttach("foo3")
>>?oCA3.CursorStatus,oCA3.Alias,GETCURSORADAPTER(oCA3.Alias),DBF(oCA3.Alias)
>>
>>return
>>
>>
>>Thanks,
>>Aleksey.
Simon White
dCipher Computing
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform