Not sure I buy your test cases.
I don't either, but for diverging reasons.
Fields containg double quotes must be in double quotes. So only one
of your examples is valid
first,""second"",third
I'll have to fix that one.
No, it's invalid. Apply to " the same rules that apply to ' for
literals in SQL statements: if user data consists of 'ABC' (including
the quotes), then the fragment SQL is
WHERE column = '''ABC''' (i.e. you still need the outer quotes).
So the above should be:
first,"""second""",third
BUT, fields that don't start with a " delimiter shouldn't be considered
delimited.
first,second"",third
has 3 data fields for me:
first
second""
third
Also fields starting with a " delimiter should comply with the rules.
first,""second,third
^------------------ missing comma separator
I could add the CR/LF...but I've never seen that used in a CSV
format. Then again, may as well use the standard. That's the nice
thing about standards...there are so many to choose from :-)
I've had to process many CSVs with either 0x00, CR, LF or CRLF
embedded. Some TSV (Tab separated values), some with ; as separators,
even some with multiline comments...
JcD
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users