Changeset: e09acbeb9e9e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e09acbeb9e9e
Modified Files:
        clients/mapiclient/mclient.c
Branch: Oct2014
Log Message:

Allow argument of \fcsv= and \fcsv+ to be quoted with double quotes.


diffs (35 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1432,7 +1432,7 @@ SQLrenderer(MapiHdl hdl, char singleinst
 }
 
 static void
-setFormatter(char *s)
+setFormatter(const char *s)
 {
        if (separator)
                free(separator);
@@ -1451,10 +1451,20 @@ setFormatter(char *s)
                separator = strdup(",");
        } else if (strncmp(s, "csv=", 4) == 0) {
                formatter = CSVformatter;
-               separator = strdup(s + 4);
+               if (s[4] == '"') {
+                       separator = strdup(s + 5);
+                       if (separator[strlen(separator) - 1] == '"')
+                               separator[strlen(separator) - 1] = 0;
+               } else
+                       separator = strdup(s + 4);
        } else if (strncmp(s, "csv+", 4) == 0) {
                formatter = CSVformatter;
-               separator = strdup(s + 4);
+               if (s[4] == '"') {
+                       separator = strdup(s + 5);
+                       if (separator[strlen(separator) - 1] == '"')
+                               separator[strlen(separator) - 1] = 0;
+               } else
+                       separator = strdup(s + 4);
                csvheader = 1;
        } else if (strcmp(s, "tab") == 0) {
                formatter = CSVformatter;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to