Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up a lookup with a large character field
Message
From
12/02/2002 04:40:32
 
 
To
12/02/2002 03:55:00
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00618638
Message ID:
00618723
Views:
18
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
Previous
Reply
Map
View

Click here to load this message in the networking platform