Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rushmore, don't get it
Message
De
21/04/2005 07:49:55
 
 
À
21/04/2005 07:38:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01006860
Message ID:
01006910
Vues:
47
>Thanks for confirming. I was hoping there was a way around. There's an index I cannot use. O hell, as long as it works

SB was as usual faster, so I won't post about versions again <g>.

but the following might put you on a track to use a slightliy less optimized version in vfp6 (I left the output as before, you might make the output dependant on the actual "findings" for easier reading...
= do_it()

function Do_It()
	clea

	set ansi on
	set exact on
	set collate to 'machine'
	set optimize on

	create cursor CursorTest ;
		( 	j_ref		I ;
		)

	insert into CursorTest values(44 )
	insert into CursorTest values( 0 )
	insert into CursorTest values(44 )

	index on bintoc(j_ref) tag bin2c
	index on PadR(bintoc(j_ref), 5) tag PadR2c

	? set("order")
	scan
		? recno(), j_ref
	endscan

	set order to 
	? set("order")
	scan
		? recno(), j_ref
	endscan

	set order to bin2c
	? set("order")
	scan
		? recno(), j_ref
	endscan

	?'*******************************'
	local lcZero, lc44, lnNum
	? set("order")
	go top
	lc44 = bintoc(j_ref)
	lnNum = 44
	? recno(), j_ref, bintoc(j_ref), m.lc44, bintoc(44), bintoc(m.lnNum)
	skip
	lcZero = PadR(bintoc(j_ref), 5)
	lnNum = 0
	? recno(), j_ref, bintoc(j_ref), m.lcZero, bintoc(0), bintoc(m.lnNum)

	?'-------------------------------------'
	? set("order")

	* locate for PadR(bintoc(j_ref), 5) == PadR(bintoc(0), 5)
	locate for PadR(bintoc(j_ref), 5) == m.lcZero
	?'optimize locate 0 (TRUE)', found(), '  ERROR', recno()

	locate for (bintoc(j_ref) == bintoc(0)) NOOPTIMIZE
	?'no optimize locate 0 (TRUE)', found(), ' OK', recno()

	local aa[1]
	aa[1] = 0

	select count(*) ;
		from CursorTest ;
		into array aa ;
		where Padr(bintoc(j_ref), 5) == m.lcZero

	?'optimize count 0 (1):', aa[1], ' ERROR'

	set optimize off
	select count(*) ;
		from CursorTest ;
		into array aa ;
		where (bintoc(j_ref) == bintoc(0))
	set optimize on

	?'no optimize count 0 (1):', aa[1], aa[1], ' ERROR'


	locate for (bintoc(j_ref) == bintoc(44))
	?'optimize locate 44 (TRUE), recno 1:', found(), 'OK ', recno()

	insert into CursorTest  values( 0 )
	locate for (bintoc(j_ref) == bintoc(0))
	?'optimize locate 0 (TRUE), recno 2:', found(), recno(), 'ERROR'


endfunc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform