Changeset: 0852de739c2b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0852de739c2b
Added Files:
        sql/test/copy/Tests/no_escape2.sql
        sql/test/copy/Tests/no_escape2.stable.err
        sql/test/copy/Tests/no_escape2.stable.out
Modified Files:
        sql/test/copy/Tests/All
Branch: atom_strings
Log Message:

Add and approve test


diffs (83 lines):

diff --git a/sql/test/copy/Tests/All b/sql/test/copy/Tests/All
--- a/sql/test/copy/Tests/All
+++ b/sql/test/copy/Tests/All
@@ -14,3 +14,4 @@ nonutf8
 incorrect_columns
 columns
 no_escape
+no_escape2
diff --git a/sql/test/copy/Tests/no_escape2.sql 
b/sql/test/copy/Tests/no_escape2.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/no_escape2.sql
@@ -0,0 +1,16 @@
+START TRANSACTION;
+
+CREATE TABLE IF NOT EXISTS json_data (id INT, jdata JSON);
+
+COPY 2 RECORDS INTO json_data FROM STDIN DELIMITERS E',',E'\n',E'|';
+1,"abc"
+2,|["This CSV field needs to be CSV quoted otherwise we cannot define JSON 
arrays since we need the comma character", "the CSV quote char (pipe) MUST be 
escaped: \|", "backslash MUST be escaped twice (once for JSON and ONCE for 
CSV): \\\\"]|
+
+COPY 2 RECORDS INTO json_data FROM STDIN DELIMITERS E',',E'\n',E'|' NO ESCAPE;
+1,"abc"
+2,|["This CSV field needs to be CSV quoted otherwise we cannot define JSON 
arrays since we need the comma character", "the CSV quote char (pipe) CANNOT 
occur here. It would end the CSV field.", "backslash does not need to be CSV 
escaped, but MUST be JSON escaped: \\"]|
+
+SELECT * FROM json_data;
+
+
+ROLLBACK;
diff --git a/sql/test/copy/Tests/no_escape2.stable.err 
b/sql/test/copy/Tests/no_escape2.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/no_escape2.stable.err
@@ -0,0 +1,12 @@
+stderr of test 'no_escape2` in directory 'sql/test/copy` itself:
+
+
+# 16:29:53 >  
+# 16:29:53 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-2897083" "--port=34707"
+# 16:29:53 >  
+
+
+# 16:29:53 >  
+# 16:29:53 >  "Done."
+# 16:29:53 >  
+
diff --git a/sql/test/copy/Tests/no_escape2.stable.out 
b/sql/test/copy/Tests/no_escape2.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/no_escape2.stable.out
@@ -0,0 +1,32 @@
+stdout of test 'no_escape2` in directory 'sql/test/copy` itself:
+
+
+# 16:29:53 >  
+# 16:29:53 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-2897083" "--port=34707"
+# 16:29:53 >  
+
+#START TRANSACTION;
+#CREATE TABLE IF NOT EXISTS json_data (id INT, jdata JSON);
+#COPY 2 RECORDS INTO json_data FROM STDIN DELIMITERS E',',E'\n',E'|';
+#1,"abc"
+#2,|["This CSV field needs to be CSV quoted otherwise we cannot define JSON 
arrays since we need the comma character", "the CSV quote char (pipe) MUST be 
escaped: \|", "backslash MUST be escaped twice (once for JSON and ONCE for 
CSV): \\\\"]|
+[ 2    ]
+#COPY 2 RECORDS INTO json_data FROM STDIN DELIMITERS E',',E'\n',E'|' NO ESCAPE;
+#1,"abc"
+#2,|["This CSV field needs to be CSV quoted otherwise we cannot define JSON 
arrays since we need the comma character", "the CSV quote char (pipe) CANNOT 
occur here. It would end the CSV field.", "backslash does not need to be CSV 
escaped, but MUST be JSON escaped: \\"]|
+[ 2    ]
+#SELECT * FROM json_data;
+% sys.json_data,       sys.json_data # table_name
+% id,  jdata # name
+% int, json # type
+% 1,   265 # length
+[ 1,   "\"abc\""       ]
+[ 2,   "[\"This CSV field needs to be CSV quoted otherwise we cannot define 
JSON arrays since we need the comma character\", \"the CSV quote char (pipe) 
MUST be escaped: |\", \"backslash MUST be escaped twice (once for JSON and ONCE 
for CSV): \\\\\"]"    ]
+[ 1,   "\"abc\""       ]
+[ 2,   "[\"This CSV field needs to be CSV quoted otherwise we cannot define 
JSON arrays since we need the comma character\", \"the CSV quote char (pipe) 
CANNOT occur here. It would end the CSV field.\", \"backslash does not need to 
be CSV escaped, but MUST be JSON escaped: \\\\\"]"     ]
+#ROLLBACK;
+
+# 16:29:53 >  
+# 16:29:53 >  "Done."
+# 16:29:53 >  
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to