Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building a string
Message
From
05/04/2010 17:02:37
 
 
To
05/04/2010 15:11:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01458765
Message ID:
01458828
Views:
60
Jos,
I did a SELECT 3 fields from a table of 10,479 records, 24 field, 389 length into a temp table then did a COPY TO .... TAB.
The 5 times I got were all less than .075 seconds with the query taking from .038 - .049 seconds and the writing of the delimited file .023-.024 seconds.
I was just curious.
Sammie

>I see that - I ran a test with larger strings/more fields and indeed the disk file option starts to become a better contender than handling the large strings in memory. Thanks!
>
>
>>Yes my suggestion is for a large string.
>>
>>>Sergey, I have done some tests. Your suggestion is much slower (17.2 sec) compared to building a string (0.75 sec) or using TEXTMERGE (0.8 sec). It would seem that for the file size I am using that building the string is a good option.
>>>
>>>UPDATE: I am using 10,000 records and combining 3 fields.
>>>
>>>
>>>>It has been proven that writing to a file line by line could be faster than building string in a memory.
>>>>I would try
>>>>
>>>>lcFileName = "..."
>>>>ERASE(lcFileName) 
>>>>SCAN 
>>>>
>>>>lcLine = myTable.Field1 + CHR(9) + myTable.Field2 + CHR(9) + CHR(13)
>>>>
>>>>STRTOFILE(lcLine , lcFileName, .T.)
>>>>
>>>>ENDSCAN
>>>>cMyString = FILETOSTR(lcFileName)
>>>>
>>>>
>>>>>I need to add extra formatting text between fields and dependent on field contents. So simple COPY will not work. Do you think using SET TEXTMERGE TO VARIABLE will be faster?
>>>>>
Previous
Reply
Map
View

Click here to load this message in the networking platform