Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Puzzle: Every trick creates a booby-trap
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Puzzle: Every trick creates a booby-trap
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01042614
Message ID:
01042614
Vues:
43
This is not a bug,
but only a consequence
of the fact that VFP doesn't have indexes with variable-length key,
and therefore the team is invented an workaround:
CLEAR
ON ERROR ? MESSAGE()

? "1 CHARACTER VARCHAR(10)"

? "RTRIM NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on Test(RTRIM(A)) TAG t1
INSERT INTO testindex VALUES ('1')

? "LTRIM NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on Test(LTRIM(A)) TAG t2
INSERT INTO testindex VALUES ('1')

? "RTRIM INDIRECT NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on TESTR(A) TAG t3
INSERT INTO testindex VALUES ('1')

? "LTRIM INDIRECT NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on TESTL(A) TAG t4
INSERT INTO testindex VALUES ('1')

?
? "2 CHARACTERS VARCHAR(10)"

? "RTRIM NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on Test(RTRIM(A)) TAG t1
INSERT INTO testindex VALUES ('12')

? "LTRIM NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on Test(LTRIM(A)) TAG t2
INSERT INTO testindex VALUES ('12')

? "RTRIM INDIRECT NOT FAIL"
CREATE CURSOR testindex (a V(10))
INDEX on TESTR(A) TAG t3
INSERT INTO testindex VALUES ('12')

? "LTRIM INDIRECT FAIL !!!!!"
CREATE CURSOR testindex (a V(10))
INDEX on TESTL(A) TAG t4
INSERT INTO testindex VALUES ('12')

PROCEDURE test(x)
	RETURN x
	
PROCEDURE TESTL(X)
	RETURN LTRIM(X)
	
PROCEDURE TESTR(X)
	RETURN RTRIM(X)
Very better if they added a clause to INDEX ON that declared the type of key,
and in this case they skipped the phase of analysis:
INDEX ON ..... TYPE V(10)
Fabio
Répondre
Fil
Voir

Click here to load this message in the networking platform