Changeset: 289e010c2493 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=289e010c2493
Modified Files:
        clients/mapiclient/mclient.c
Branch: Apr2019
Log Message:

No need to do the same test multiple times.


diffs (49 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1512,25 +1512,26 @@ SQLrenderer(MapiHdl hdl)
                char *s;
 
                len[i] = mapi_get_len(hdl, i);
-               if (len[i] == 0 &&
-                   ((s = mapi_get_type(hdl, i)) == NULL ||
-                    (strcmp(s, "varchar") != 0 &&
-                     strcmp(s, "clob") != 0 &&
-                     strcmp(s, "char") != 0 &&
-                     strcmp(s, "str") != 0 &&
-                     strcmp(s, "json") != 0))) {
-                       /* no table width known, use maximum, rely on
-                        * squeezing later on to fix it to whatever is
-                        * available; note that for a column type of
-                        * varchar, 0 means the complete column is
-                        * NULL or empty string, so MINCOLSIZE (below)
-                        * will work great */
-                       len[i] = pagewidth <= 0 ? DEFWIDTH : pagewidth;
-               } else if (len[i] == 0 &&
-                          strcmp(mapi_get_type(hdl, i), "uuid") == 0) {
-                       /* we know how large the UUID representation
-                        * is, even if the server doesn't */
-                       len[i] = 36;
+               if (len[i] == 0) {
+                       if ((s = mapi_get_type(hdl, i)) == NULL ||
+                           (strcmp(s, "varchar") != 0 &&
+                            strcmp(s, "clob") != 0 &&
+                            strcmp(s, "char") != 0 &&
+                            strcmp(s, "str") != 0 &&
+                            strcmp(s, "json") != 0)) {
+                               /* no table width known, use maximum,
+                                * rely on squeezing later on to fix
+                                * it to whatever is available; note
+                                * that for a column type of varchar,
+                                * 0 means the complete column is NULL
+                                * or empty string, so MINCOLSIZE
+                                * (below) will work great */
+                               len[i] = pagewidth <= 0 ? DEFWIDTH : pagewidth;
+                       } else if (strcmp(s, "uuid") == 0) {
+                               /* we know how large the UUID representation
+                                * is, even if the server doesn't */
+                               len[i] = 36;
+                       }
                }
                if (len[i] < MINCOLSIZE)
                        len[i] = MINCOLSIZE;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to