Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append From Must have CRLF
Message
From
01/06/2003 01:04:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
01/06/2003 00:51:00
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00794926
Message ID:
00794962
Views:
23
>>Oh, I see. You want to avoid a single chr(13) or chr(10) starting a new line. I had misunderstood this.
>>
>>Yes, VFP accepts both a single chr(13) and a single chr(10) as a line-break - at least, in some cases.
>>
>>One way to solve this is to replace the single chr(13) and chr(10) by other symbols, before and after, something like this:
>>
>>
>>MyFile = FileToStr("Import.txt")
>>MyFile = strtran(MyFile, chr(13) + chr(10), "<<NEWLINE>>"))
>>MyFile = strtran(MyFile, chr(13), "<<chr(13)>>")
>>MyFile = strtran(MyFile, chr(10), "<<chr(10)>>")
>>MyFile = strtran(MyFile, "<<NEWLINE>>", chr(13) + chr(10))
>>StrToFile(MyFile, "Import.txt")
>>* Do the import here
>>* Replace "<<chr(13)>>" with chr(13) in relevant fields
>>* Replace "<<chr(10)>>" with chr(10) in relevant fields
>>
>>
>>You could also importing through LLFF. I am not sure, right now, how "end-of-line" is interpreted in this case.
>
>The data is about 6,000,000 records just a little under 2 gigs. I can't afford the time to do a StrTran. I'm probably going to end up using SQL's Bulk Insert instead.

You could test whether the low-level file functions work as you expect. For instance, fgets() will read a line from the text-file - but as I said before, I am not sure right now what it expects as an end-of-line.

The low-level file functions are usually quite fast, but the fact that you will have to write the loop not only gives you additional work, it may also be slower than using a single IMPORT command.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform