Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speeding up a lookup with a large character field
Message
De
12/02/2002 04:40:32
 
 
À
12/02/2002 03:55:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00618638
Message ID:
00618723
Vues:
24
This may be a bit faster

not sure which one is the faster in the scan rest (for or while, suspect for)
function IsItIn(PathToFind, TheTable)

	local IndexedKey, s, OldOrder, sCollate, FoundIt
	
	s = select(0)
	select (TheTable)
	OldOrder = order()
	sCollate = set('Collate')
	set Collate to 'Machine'
	
	IndexedKey = bintoc(val(sys(2007, PathToFind)))
	set Order to ThePath
	
	FoundIt = FALSE
	
	if( seek(IndexedKey) )
	
		scan rest for/while ( bintoc(val(sys(2007, ThePath))) == IndexedKey )
			if( ThePath == PathToFind )
				FoundIt = TRUE
				exit
			endif
		endscan
	endif
	
	set order to &OldOrder
	select (s)
	set Collate to (sCollate)
	
	return FoundIt  && and still on the record

endfunc
*--------------------------------------------------------------------------
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform