Hi,

I'm sorry, but the lineSeparator option is only used when writing. It is
not supported for reading (when reading, a newline / line feed is required;
this is hardcoded). I will document this limitation.

The rowSeparator is also only used for writing. Actually I will remove the
rowSeparator setting, as the same can be achieved with the lineSeparator.

If you want to use a line separator that is different from \r and \n, then
I'm afraid you will need to use your own parser (which would be much
simpler and faster anyway than to use the CSV tool), or preprocess the file
in some way.

Regards,
Thomas




On Monday, September 8, 2014, t603 <[email protected]> wrote:

> Hello,
>
> according to my observations and tests, it looks like, that the latest
> stable H2, 1.3.176, has a bug or missing capability or documented
> limitation. All about one thing - separator of lines of CSV file to be read
> using csvread. Let assume following code:
>
> create table t1 (id int, name varchar(255));
> insert into t1 (id, name) values (01, 'a');
> insert into t1 (id, name) values (02, 'b');
> select * from t1;
>
> -- OK
> call csvwrite('C:\temp\temp\logdb\test3.txt', 'select * from t1',
> 'charset=UTF-8 fieldSeparator=x fieldDelimiter= lineSeparator=y');
> -- not OK
> select * from csvread('C:\temp\temp\logdb\test3.txt', null, 'charset=UTF-8
> fieldSeparator=x fieldDelimiter= lineSeparator=y');
>
> The latest command interprets the output of previous command wrong.
>
> Use case ~ why I want it. Very detailed explanation is described at How
> to put into the CSV (text) output of XSL-T 2.0 transformation XML illegal
> characters like 1E “record separator” and 1F “unit separator”?
> <http://stackoverflow.com/questions/25669441/how-to-put-into-the-csv-text-output-of-xsl-t-2-0-transformation-xml-illegal-ch>
> article of StackOverflow. Shortly: while fast processing huge load of (let
> say XML) input data to produce CSV, it is very inefficient to use string
> replace-like functions to escape double quotes etc. I would like to use (in
> case of XML 1.0) column and row separators ~ single characters, that could
> not never appear in the source. So my choice in case of XML 1.0 are 1E and
> 1F.
>
> I also think, that it could be consistent, that if csvwrite has such
> capability, csvread does not. I already rise such feature request years ago
> in the thead of this group
> <https://groups.google.com/forum/#!searchin/h2-database/rowSeparator/h2-database/p7IFChKiNiQ/B80TRyBf4UkJ>.
> Till now, I was able to bypass it using string-replace functions using awk,
> xsl-t etc. but not know, because replacing is very time consuming.
>
> Thank You in advance for your answer, Stepan
>
> P.S.: What is the difference between lineSeparator and rowSeparator in
> csvOprtion?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to