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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only