Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question on passing cursor
Message
De
23/10/2003 09:24:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/10/2003 08:59:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00841515
Message ID:
00841531
Vues:
23
>In VFP8, what is the 'best practice' for passing a cursor as an object to a black box function?
>
>Basically, I have a function called 'GetHistory'. I'd like to set it up to retrieve history for one account, or a dozen accounts, or hundreds of accounts. I'd like to pass it a cursor object containing a list of accounts...and then have it return a cursor object containing the results.
>
>I've been looking at the new XMLAdapter and how I might be able to use it...but was curious if others had tried this, and what the recommended approach would be.
>
>Thanks,
>Kevin

Kevin,
I use something like this to pass cursors between private datasessions :
o = CreateObject('myTest')
loRet = o.GetRecords('* from customer')
Create Cursor Results from array loRet.aStruc
For ix=1 to Alen(loRet.aRecords,1)
	Append Blank
	Gather name loRet.aRecords[ix]
EndFor
Browse

Define Class myTest As Session
	DataSession = 2

	Procedure Init
		this.Addproperty('oCargo',Createobject('custom'))
		this.oCargo.AddProperty('aStruc[1]', .null. )
		This.oCargo.AddProperty('aRecords[1]',.Null.)
	EndProc
	Procedure GetRecords
			Lparameters tcSQL
			Select &tcSQL into cursor crsTemp nofilter
			Dimension this.oCargo.aRecords[Reccount()]
			Scan
				Scatter Name This.oCargo.aRecords[Recno()]
			EndScan
			AFields(this.oCargo.aStruc)
		Return this.oCargo	
	endproc	
Enddefine
XML would do too and would be better for over 65000 recs.
PS: It's only a sample. Real code does an optimized version.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform