Changeset: ec9d75482638 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ec9d75482638
Modified Files:
        clients/mapilib/mapi.c
Branch: Apr2019
Log Message:

Deal with completely empty values from the server.
Try, e.g. SELECT X'',X'';.


diffs (51 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3628,7 +3628,7 @@ slice_row(const char *reply, char *null,
        i = 0;
        anchors = length == 0 ? NULL : malloc(length * sizeof(*anchors));
        lens = length == 0 ? NULL : malloc(length * sizeof(*lens));
-       do {
+       for (;;) {
                if (i >= length) {
                        length = i + 1;
                        REALLOC(anchors, length);
@@ -3642,9 +3642,17 @@ slice_row(const char *reply, char *null,
                }
                lens[i] = len;
                anchors[i++] = start;
-               while (reply && *reply && isspace((unsigned char) *reply))
+               if (reply == NULL)
+                       break;
+               while (*reply && isspace((unsigned char) *reply))
+                       reply++;
+               if (*reply == ',') {
                        reply++;
-       } while (reply && *reply && *reply != endchar);
+                       while (*reply && isspace((unsigned char) *reply))
+                               reply++;
+               } else if (*reply == 0 || *reply == endchar)
+                       break;
+       }
        *anchorsp = anchors;
        *lensp = lens;
        return i;
@@ -4753,8 +4761,6 @@ unquote(const char *msg, char **str, con
                /* skip over trailing junk (presumably white space) */
                while (*p && *p != ',' && *p != endchar)
                        p++;
-               if (*p == ',')
-                       p++;
                if (next)
                        *next = p;
                *str = start;
@@ -4776,8 +4782,7 @@ unquote(const char *msg, char **str, con
                        ;
                if (s < msg || !isspace((unsigned char) *s))    /* gone one too 
far */
                        s++;
-               if (*p == ',' || *p == '\t') {
-                       /* there is more to come; skip over separator */
+               if (*p == '\t') {
                        p++;
                }
                len = s - msg;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to