Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import text file - more than 256 fields
Message
From
28/03/2004 21:15:21
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00890295
Message ID:
00890314
Views:
18
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform