Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import text file - more than 256 fields
Message
De
28/03/2004 21:15:21
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00890295
Message ID:
00890314
Vues:
17
Hi David,

I assumed that VFP didn't use file buffering for low-level reads. I did a test without the parsing and it was a lot faster. So I guess it must indeed be the parsing code that is so slow. This is the code:
DO WHILE .T.
DataString = FGETS(nCDataHandle,5000)
SELECT FD
m.Start = 1
SCAN
m.FieldNum = FD.Field_Name
FieldData = SUBSTR(DataString,m.Start,FD.Field_Len)
&FieldNum = IIF(FD.Field_Type = 'N',VAL(m.FieldData),m.FieldData)
m.Start = m.Start + FD.Field_Len
ENDSCAN

INSERT INTO (OutputName) FROM MEMVAR

IF FEOF(nCDataHandle)
EXIT
ENDIF
ENDDO

FD is a table that contains the field definitions for the input file. It is used to create the table that will contain the data (using the CREATE FROM command) and is also used to parse the text.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform