Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OOP COM problem
Message
De
15/02/1999 18:24:43
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
 
 
À
15/02/1999 16:03:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Divers
Thread ID:
00187802
Message ID:
00187861
Vues:
17
This is a tricky issue. You basically have three choices:

1) Create the array as a property of the object. Then you can access it directly, i.e. object.array(1). I often use arrays of objects in this way to create collections: object.array(1).property. To show data SCATTER NAME works pretty well here. The disadvantage is that you've created a stateful object that must stay in scope in order to get it's data. You could iterate the result set to retrieve the results to the client and store them somewhere, but in the case of large result sets this might be inefficient since you would be making many calls over the COM layer.

2) Use COMARRAY. If yor client is VFP, then you can set =COMARRAY(11), create an array on the client, and pass it by reference to the server:

=COMARRAY(11)
DECLARE aArray(25)
=MyServer.populatearray(@aArray)

The only gotcha here is that the server can't redimension the array, so you have to size it properly before passing it:

=COMARRAY(11)
nSize=MyServer.seekrecords()
DECLARE aArray(nSize)
=MyServer.populatearray(@aArray)

3) Pick a different transport mechanism. You can convert result sets to primitives (like strings), a la SDF files or XML, and reconstitute them into cursors from the client. XML works exceptionally well for this. Ken Levy's got a dbftoxml utility on his Web site that works pretty well (www.classx.com). With XML you have the added advantage of letting any client that works with XML read the result set. Eventually (hopefully) ADO will start to work this way with VFP too.

Hope this helps.

>Sorry,
>I didn't know where to put this question because there is no COM subcategory listed. I have created a COM dll in FoxPro which uses the seek command to locate records in a table. The program works fine. However, now I need to return the records that are found. The way I wish to do this is to read the records into an array and then pass the array back across the COM boundaries. Does anybody have any experience with this? The literature and MSDN is extremely limited on information for COM/FoxPro integration.
>
>Thanks,
>Mike Richardson
>Distributed Objex, Inc.
Eric Shaneson
Cutting Edge Consulting
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform