ImportText failures

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Jun 22 20:39:56 CDT 2004


On 6/22/04 7:45 PM, "va_refinancing at mail.com" <va_refinancing at mail.com>
wrote:

I have CC this to our developer team list.
We will try add such tests for 2.0

> 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.

I think all right. You have find some glitches and holes in Valentina 1.x
import, as I see.

In Valentina 2.0 we have made instead by-hand parser of text file,
A new parser generated by ANTLR.


> 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.

If you do Cursor.Import() then after import cursor have ALL imported
records. So you can ask it how many records was added, and even delete all
imported records to refuse operation.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list