Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using same CursorAdapter over again
Message
 
 
À
25/06/2010 11:59:01
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01470556
Message ID:
01470593
Vues:
42
>>Hi,
>>
>>I am testing how I could implement CA as a public object (or referenced by application object) such that it can be used over and over for different SQL commands. For example, when creating reports I need to send to DB a SQL Select and get back the cursor for the report. So my idea is to use the same CA object for all reports.
>>
>>Here is what I tried:
>>
>>1. Created CA (DataSourceType'ADO'), set all the necessary ADODB properties. Then I call CursorFill() and get the cursor for the report.
>>2. Then I close the cursor (use in ("mycursorname"))
>>
>>To get cursor for another report I do the following
>>1. Set new value of alias for the existing CursorAdapter
>>2. Set new value of SelectCmd for the existing CursorAdapter
>>3. Call CursorFill().
>>I get another cursor with no problem.
>>
>>My question is, do you see any potential problems with this approach?
>>
>>TIA.
>
>In OOP terms the design is supposed to be singular, and reused multiple times as instances at runtime. Your way, you will trade space for slowness, by having the overhead of constantly updating the single instance at runtime.

Thank you for your input. Obviously I don't want to slow down the report generation. And this is why I thought that by keeping the CA object instantiated at all time will speed up getting the data from SQL Server. What I don't understand is what you mean by "constantly updating the single instance"? If not updating the single instance with the change of values of a couple of properties, wouldn't instantiating it again, every time, will be slower?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform