Changeset: 2d3e3c26778b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d3e3c26778b
Modified Files:
        ctest/tools/monetdbe/example_copy.c
        sql/backends/monet5/sql.c
Branch: default
Log Message:

Copy into file monetdbe + example_copy test update


diffs (45 lines):

diff --git a/ctest/tools/monetdbe/example_copy.c 
b/ctest/tools/monetdbe/example_copy.c
--- a/ctest/tools/monetdbe/example_copy.c
+++ b/ctest/tools/monetdbe/example_copy.c
@@ -26,10 +26,12 @@ main(void)
        if (monetdbe_open(&mdbe, NULL, NULL))
                error("Failed to open database");
 
-       if ((err = monetdbe_query(mdbe, "CREATE TABLE test (b bool, x integer, 
f float, y string)", NULL, NULL)) != NULL)
+       if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL)
                error(err)
-
-       if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (TRUE, 42, 
42.42, 'Hello'), (NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL)
+       if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (42, 'Hello', 
'2020-01-02 10:20:30', '2020-01-02', '10:20:30', '01020308'), \
+                                                                               
                                        (NULL, 'World', NULL, NULL, NULL, 
NULL),        \
+                                                                               
                                        (NULL, 'Foo', NULL, NULL, NULL, NULL), \
+                                                                               
                                        (43, 'Bar', '2021-02-03 11:21:31', 
'2021-02-03', '11:21:31', '01020306')", NULL, NULL)) != NULL)
                error(err)
 
        // Get working directory and construct the CSV path
@@ -40,12 +42,12 @@ main(void)
 
     strcpy(sql, "COPY SELECT * FROM test INTO '");
     strcat(sql, csv_path);
-    strcat(sql, "' USING DELIMITERS ',' NULL AS ''");
+    strcat(sql, "' USING DELIMITERS ','");
 
        if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL)
                error(err)
        
-       if ((err = monetdbe_query(mdbe, "CREATE TABLE test_copy (b bool, x 
integer, f float, y string)", NULL, NULL)) != NULL) {
+       if ((err = monetdbe_query(mdbe, "CREATE TABLE test_copy (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL) {
                delete_file(csv_path)
                error(err)
        }
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2657,6 +2657,7 @@ mvc_export_table_wrap( Client cntxt, Mal
                        close_stream(s);
                        goto wrapup_result_set1;
                }
+               be->output_format = OFMT_CSV;
        } else {
                while (!m->scanner.rs->eof)
                        bstream_next(m->scanner.rs);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to