Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array passing in SQL UDF
Message
De
09/01/2000 10:56:54
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00314970
Message ID:
00315128
Vues:
1567
> Select * from Customer where cust_ID in (SELECT cust_ID from CurSelectedItems).
> Same approach DF adviced.
> HTH

Actually that is different from what DF suggests but you get the idea. David's suggestion is what I want to do.
What I was doing is in the following code:
Function fSeekpair

** determine if cPerson_id has bought all the items in ItemsArray
** Purchase table has an index on cPerson_id+cItem_id.     ItemsArray is an array of cItem_id

Parameters cPerson_id, ItemsArray, nArraySize

Local nCnt, lPairFound

nCnt = 1
lPairFound = .T.
	
Do While nCnt <= nArraysize.AND.lPairFound
	lPairFound=Seek(cPerson_id+aItemsArray[li,1],'PURCHASE','Person_Item') .AND. lPairFound
	li=li+1
EndDo

Return lPairFound
To get all people who bought the n items in aItemsArray
Select cPerson_id from PERSONS where fseekpair(cPerson_id,@Itemlist,Itemlistnumber) ;
                into cursor something
I will try David's approach since it does look much cleaner but I'm still trying to figure out
1) Why does this function work when called directly but loses it in the SQL Select
2) Why is this a bad way to do this? What problems can it cause (ED).

Thanks everyone for all the help
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform