Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can anybody explain this behavior of cursoradapter ?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00777389
Message ID:
00778254
Views:
18
Thanks for the helpfull information. Now I have more clear picture how it works. However still stay something that I do not understand. In my forms I use connection opened with SQLSTRINGCONNECT( lcConnString ) so it should be not shared connection as I know now, however the form works and cursors are filled. When I set SQLSTRINGCONNECT(...,.f. ) in Jim example code - the compiled program breaks as it should on line "this.DataSource = SQLConnect( this.Parent.datasource )" in cursoradapter init method with message "connection handle is invalid". I do not understand why work my form - form that is using DataEnvironment connection which has shared=.f.and is composed of several cursoradapters with property usededatasource = .T. Other forms are connected to the same connection (opened on application level) and also works. All cursors has FetchSize=-1.

>
>Depending on result set size and network connection speed, fetch at once (FetchSize=-1) may take significant amount of time. If you have several CursorAdapter object like this on the form, the form instantiation may be very slow.
>
>If all result sets are "small" and you are satisfied with how fast your form is instantiated then FetchSize=-1 for all CursorAdapter objects is a perfect solution.
>
>Jim's solution work's too, it will work slower, but it'll better handle scenarios when some CursorAdapter objects don't use FetchSize=-1.
>
>Another way to go, especially when the form instantiation is very slow, is to use dedicated connection/statement handles for each CursorAdapter object. Here you also have a choice:
>a) To use dedicated ODBC connection for each CursorAdapter object. Advantage - you don't have to worry about FetchSize and AllowSimultaneousFetch settings. Disadvantage - multiple connections to the server.
>
>b) To use the same "shared" ODBC connection in conjunction with dedicated ODBC statement handle (for more information about shared connection see help topic for SQLCONNECT function) for each CursorAdapter. To make sure this approach always works, AllowSimultaneousFetch=.T. must be used for all CursorAdapter objects. All CursorAdapter objects will share one connection to the server, all will be successfully "filled", form instantiation will be fast, but later it may run slower because fetch for AllowSimultaneousFetch=.T. is slower.
>
>There is no single approach that will work perfectly for all scenarios, which one to use should be decided on a case by case basis.
>
>Thanks,
>Aleksey.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform