Changeset: cc3523cf5227 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc3523cf5227
Modified Files:
        tools/merovingian/client/monetdb.c
Branch: Dec2011
Log Message:

monetdb: hide properties that do not apply better

Don't display properties for funnels on database objects and vice-versa,
not only for the "all" list, but also when explicitly asked for.


diffs (64 lines):

diff --git a/tools/merovingian/client/monetdb.c 
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -1182,7 +1182,7 @@ command_get(int argc, char *argv[])
                orig = stats;
        }
 
-       /* suppress header when there are no results */
+       /* avoid work when there are no results */
        if (orig == NULL) {
                free(props);
                return;
@@ -1226,22 +1226,13 @@ command_get(int argc, char *argv[])
                free(buf);
 
                if (propall == 1) {
-                       kv = findConfKey(props, "type");
-                       if (kv != NULL && kv->val != NULL &&
-                                       strcmp(kv->val, "mfunnel") == 0)
-                       {
-                               snprintf(vbuf, sizeof(vbuf), 
"name,type,mfunnel,shared");
-                       } else {
-                               size_t off = 0;
-                               kv = props;
-                               off += snprintf(vbuf, sizeof(vbuf), "name");
-                               while (kv->key != NULL) {
-                                       if (strcmp(kv->key, "mfunnel") != 0 &&
-                                                       strcmp(kv->key, "type") 
!= 0)
-                                               off += snprintf(vbuf + off, 
sizeof(vbuf) - off,
-                                                               ",%s", kv->key);
-                                       kv++;
-                               }
+                       size_t off = 0;
+                       kv = props;
+                       off += snprintf(vbuf, sizeof(vbuf), "name");
+                       while (kv->key != NULL) {
+                               off += snprintf(vbuf + off, sizeof(vbuf) - off,
+                                               ",%s", kv->key);
+                               kv++;
                        }
                } else {
                        /* check validity of properties before printing them */
@@ -1267,6 +1258,21 @@ command_get(int argc, char *argv[])
                while ((p = strtok(buf, ",")) != NULL) {
                        buf = NULL;
 
+                       /* filter properties based on object type */
+                       kv = findConfKey(props, "type");
+                       if (kv != NULL && kv->val != NULL) {
+                               if (strcmp(kv->val, "mfunnel") == 0) {
+                                       if (strcmp(p, "name") != 0 &&
+                                                       strcmp(p, "type") != 0 
&&
+                                                       strcmp(p, "mfunnel") != 
0 &&
+                                                       strcmp(p, "shared") != 
0)
+                                               continue;
+                               }
+                       } else { /* no type == database (default) */
+                               if (strcmp(p, "mfunnel") == 0)
+                                       continue;
+                       }
+
                        /* special virtual case */
                        if (strcmp(p, "name") == 0) {
                                source = "-";
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to