Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Universal approach to access multiple datasources
Message
 
À
07/04/1999 18:16:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00205922
Message ID:
00206390
Vues:
13
>>>Hi, Igor!
>>>
>>>>I need some ideas on how to create an application. This application will be >distributed to several clients. One client has data stored in MS Access, >another client - in native VFP 5.0 tables. What is the best approach to design >the application?
>>>
>>>The best way is full isolating front-end application from data source. This is a kind of well-known multi-tier approach. You provide class(es) that exclusively communicate with data source. You application knows only how to "talk" with that object (component), i.e. application is advised what method(with what parameters) must be called to get a cursor, what method must be called to modify specific data and so on. Deployment can be the following:
>>>
>>>Application instantiates the object oData
>>>oData connects to the database through ODBC or ADO
>>>Application calls method oData.GetCustomersList()
>>>oData calls appropriate stored procedure on the server on perform SQL passtrough
>>>oData pass received data to the application as VFP table, cursor or array (it can depend of data object location - using COM we can have it on remote computer)
>>>...
>>>
>>>I.e. if different clients prefer work with different server you showld have two different oData class with the same methods/properties (and something on server level), not two different applications. And supply your clients with appropriate oData classes.
>>>
>>>As for middle-tier implementation details I recommend you use ADO for MS SQL and native VFP code for VFP database. You can implement both components using VFP as out-of-process OLE-servers.
>>>
>>>It is very huge topic... If you have detailed questions - welcome.
>>
>>Hi Dmitry,
>>
>>Thank you for reply. I'll definitly use data class to access different data sources. The idea to use VFP ODBC driver from within VFP sounds very interesting. Yet I loose perfomance. Did you tried it?
>
>I did, but I don't remember whether I analysed performance. Probably not.
>You're quite right this way can help you write nearly the same code for different sources, but performance won't be optimal. Fastest way to deal with VFP data is VFP embedded SQL. Why don't you want write
>
>use vfptablepath alias tab1
>select * from tab1 where blalala into cursor cur1
>
>intstead of
>
>sqlexec(ln_vfp,'select * from vfptablepath where blablabla','cur1')
>
>in your data class? Application will receive cur1 in any way, it makes sence to prefer faster method. Don't afraid of code difference from source to source inside the class - choose best way to work with data.

I use SPT, because it gives me access to different backends, whereas VFP embedded SQL accesses native VFP tables or local views.

<> This is what Josh Weiss adviced me too.
I agree with it on 100%.
Igor Gelin
Database Developer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform