Sorry for the delay. I found one problem so far: you have used
CSVREAD('test.csv','NULL','UTF-8','\u00F6','\u00D6')
but that means use the column list 'NULL' (only one column). What you
need to write is:
CSVREAD('test.csv',NULL,'UTF-8','\u00F6','\u00D6')
I can now reproduce the second problem, but it does not occur when
running your test. I have changed the test and now I can reproduce it.
I will fix this problem and write more test cases (including random
data). This problem will be fixed in the next release.
Thanks a lot for your help!
Thomas
Class.forName("org.h2.Driver");
Connection conn =
DriverManager.getConnection("jdbc:h2:mem:", "sa", "sa");
final Statement s = conn.createStatement();
s.execute("DROP TABLE IF EXISTS t1, t2");
s.execute("CREATE TABLE t1(index INTEGER, name VARCHAR(50))");
s.execute("INSERT INTO t1 VALUES(1,'bbbb \n aaaa')");
s.execute("INSERT INTO t1 VALUES(2,'bbbb \" aaaa')");
s.execute("INSERT INTO t1 VALUES(3,'bbbb \\ aaaa')");
s.execute("INSERT INTO t1 VALUES(4,'\n')");
s.execute("INSERT INTO t1 VALUES(5,'\"')");
s.execute("INSERT INTO t1 VALUES(6,'\\')");
s.execute("INSERT INTO t1 VALUES(7,' \n')");
s.execute("INSERT INTO t1 VALUES(8,' \"')");
s.execute("INSERT INTO t1 VALUES(9,' \\')");
s.execute("INSERT INTO t1 VALUES(10,'\n ')");
s.execute("INSERT INTO t1 VALUES(11,'\" ')");
s.execute("INSERT INTO t1 VALUES(12,'\\ ')");
s.execute("CALL CSVWRITE('test.csv', 'SELECT * FROM t1',
'UTF-8', '\u00F6', '\u00D6')");
// First Method
s.execute("create table t2 as SELECT * FROM
CSVREAD('test.csv',NULL,'UTF-8','\u00F6','\u00D6')");
// Second Method
final Csv csv = Csv.getInstance();
csv.setFieldDelimiter('\u00D6');
csv.setFieldSeparatorRead('\u00F6');
ResultSet rs = csv.read("test.csv", null, "UTF-8");
while (rs.next()) {
s.execute("INSERT INTO t2 VALUES(" +
rs.getInt("index") + ",'" + rs.getString("name") + "')");