ImportText failures
va_refinancing at mail.com
va_refinancing at mail.com
Tue Jun 22 11:45:25 CDT 2004
Ruslan,
I managed to get some imports to work from VAPP (except for those with UNIX newlines and those with one line and no newline). Then, with the help of a hex editor, I even managed to get ImportText to work from REALbasic, but only under certain circumstances. All of my tests used a table with only three "long" fields. Here's a rundown of my experience using Valentina for REALbasic 1.10, REALbasic 5.5.2 Professional, and Mac OS 10.3.4:
1. myCursor.ImportText(ImportFile, ",")
- Fails on a one line CSV file if there is no newline at the end of the line.
- Works on a one line CSV file if there is a newline - Chr(13) - at the end of the line.
- Only imports the first line of a multi-line CSV file, and then only if the last line ends with a newline - Chr(13).
2. myCursor.ImportText(ImportFile, ",", Chr(10))
- Fails for all files with UNIX newlines.
3. myCursor.ImportText(ImportFile, ",", Chr(13) + Chr(10))
- Fails on a one line CSV file if there is no newline at the end of the line.
- Works on a one line CSV file if there is a newline - Chr(13) + Chr(10) - at the end of the line.
- Imports only the first line of any multi-line file, and then only if the last line ends with a newline - Chr(13) + Chr(10).
4. myCursor.ImportText(ImportFile)
- Fails for a one line tab separated value (TSV) file if there is no newline at the end of the line.
- Works for a one line TSV file if there is a newline - Chr(13) - at the end of the line.
- Works for multi-line TSV files, even if the last line does not end with a newline - Chr(13).
5. myCursor.ImportText(ImportFile, Chr(9), Chr(10))
- Fails for all files with UNIX newlines
6. myCursor.ImportText(ImportFile, Chr(9), Chr(13) + Chr(10))
- Fails on a one line TSV file if there is no newline at the end of the line.
- Works on a one line TSV file if there is a newline - Chr(13) + Chr(10) - at the end of the line.
- Works on a multi-line TSV file, even if the last line does not end with a newline - Chr(13) + Chr(10)
I haven't tested with any other delimiters, but it seems pretty consistent that the import fails with 0xA newline characters. It appears to only work with 0xD and 0xD 0xA newlines if the last line is terminated with a newline when using comma delimiters. With the default tab delimiter, it appears to work in all cases except for UNIX newlines and single line files with no terminating newline.
With this in mind, I am hopeful that I can get the data that I need for my project imported into a Valentina database. Please let me know if you see anything wrong with the code above that would account for the problems.
It would be nice if ImportText returned a value indicating the number of records imported, especially if Valentina can't/doesn't report an error condition when an import fails.
Thank you for your help.
Jon
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
More information about the Valentina
mailing list