Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL SELECT and code pages problem
Message
De
25/07/2001 23:50:38
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
SQL SELECT and code pages problem
Divers
Thread ID:
00535512
Message ID:
00535512
Vues:
43
Hi!

I'm running VFP6 (SP5) on Czech Windows 98 SE and have the following problem
in SQL-SELECT with comparing character data from these tables:
- two tables in the FoxPro 2.6 (DOS) format, code page 895 (Kamenicky)
with structure (Klic Character 1, Value Numeric 3) and 256 records
with values from CHR(0),0 to CHR(255),255. These tables are identical.
They have no indexes.

After running the following code

SET COLLATE TO "MACHINE"
USE i:\fox\keys IN 0 SHARED
USE i:\fox\keys2 IN 0 SHARED

sele * FROM KEYS K1, KEYS2 K2 ;
WHERE K1.Klic == K2.Klic ;
ORDER BY 2

I get only 245 records in the result with statements that 176=95, 177=95,
record for code 172 is missing etc. I expected 256 records with identical
values :-((

By modifying the code to the following

SET COLLATE TO "MACHINE"
USE i:\fox\keys IN 0 SHARED
USE i:\fox\keys2 IN 0 SHARED

SELECT Keys
SET NOCPTRANS TO Klic
SELECT Keys2
SET NOCPTRANS TO Klic

sele * FROM KEYS K1, KEYS2 K2 ;
WHERE K1.Klic == K2.Klic ;
ORDER BY 2

I get only 128 records in the result (for codes 0 - 127).

After getting the code to the following variation (much slower in run)

SET COLLATE TO "MACHINE"
USE i:\fox\keys IN 0 SHARED
USE i:\fox\keys2 IN 0 SHARED

SELECT Keys
SET NOCPTRANS TO Klic
SELECT Keys2
SET NOCPTRANS TO Klic

sele * FROM KEYS K1, KEYS2 K2 ;
WHERE MyFun(K1.Klic,K2.Klic) ;
ORDER BY 2

FUNCTION MyFun
LPARAMETERS tc1,tc2

RETURN tc1==tc2

I finally got the correct result (256 records with identical values).

Does it mean VFP is not capable of comparing values from tables
directly in the SQL-SELECT ?? Or what am I doing wrong ?
Any ideas ?
Pavel Kouril
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform