Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append From Must have CRLF
Message
De
02/06/2003 00:10:10
 
 
À
01/06/2003 01:04:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00794926
Message ID:
00795073
Vues:
18
>>>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.

The low level file operations are limited to 16 megs. FGets() worked the same way as the Append From.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform