Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29978

Modified Files:
        monetdb_merocom.c monetdb_set.c 
Log Message:
now we have enough convenience functions/wrappers:
implemented monetdb set shared=bla inside monetdb set, instead of with
an ugly hack in monetdb start/stop/kill (merocom) code.


U monetdb_merocom.c
Index: monetdb_merocom.c
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/monetdb_merocom.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- monetdb_merocom.c   9 Sep 2009 11:47:37 -0000       1.6
+++ monetdb_merocom.c   9 Sep 2009 12:11:41 -0000       1.7
@@ -20,8 +20,7 @@
 typedef enum {
        START = 0,
        STOP,
-       KILL,
-       SHARE
+       KILL
 } merocom;
 
 static void
@@ -48,9 +47,6 @@
                case KILL:
                        type = "kill";
                break;
-               case SHARE:
-                       type = "share";
-               break;
        }
 
        if (argc == 1) {
@@ -107,7 +103,7 @@
        } else {
                sabdb *w = NULL;
                orig = NULL;
-               for (i = mode == SHARE ? 2 : 1; i < argc; i++) {
+               for (i = 1; i < argc; i++) {
                        if (argv[i] != NULL) {
                                if ((e = SABAOTHgetStatus(&stats, argv[i])) != 
MAL_SUCCEED) {
                                        fprintf(stderr, "%s: internal error: 
%s\n", type, e);
@@ -165,20 +161,6 @@
                                printf("%s: database is already running: %s\n",
                                                type, stats->dbname);
                        }
-               } else if (mode == SHARE) {
-                       char *value = argv[1];
-                       char share[4069];
-
-                       /* stay quiet, we're part of monetdb set property=value 
*/
-
-                       snprintf(share, sizeof(share), "share=%s", value);
-                       out = control_send(&res, mero_control, 0, 
stats->dbname, share);
-                       if (out != NULL || strcmp(res, "OK") != 0) {
-                               res = out == NULL ? res : out;
-                               printf("FAILED:\n%s", res);
-                               ret = 1;
-                       }
-                       free(res);
                }
                stats = stats->next;
        }

U monetdb_set.c
Index: monetdb_set.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/monetdb_set.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- monetdb_set.c       9 Sep 2009 11:03:18 -0000       1.4
+++ monetdb_set.c       9 Sep 2009 12:11:41 -0000       1.5
@@ -84,18 +84,6 @@
                exit(1);
        }
 
-       if (strcmp(property, "shared") == 0) {
-               /* mess around with first argument (property) to become value
-                * only, such that can see if it had an argument or not lateron 
*/
-               if (type == INHERIT) {
-                       argv[1] = property;
-                       property[0] = '\0';
-               } else {
-                       argv[1] = value;
-               }
-               return(command_merocom(argc, &argv[0], SHARE));
-       }
-
        w = NULL;
        orig = NULL;
        for (i = 1; i < argc; i++) {
@@ -180,6 +168,22 @@
                                                strerror(errno));
                                state |= 1;
                        }
+               } else if (strcmp(property, "shared") == 0) {
+                       char share[4069];
+                       char *res;
+                       char *out;
+
+                       if (type == INHERIT)
+                               value = "";
+
+                       snprintf(share, sizeof(share), "share=%s", value);
+                       out = control_send(&res, mero_control, 0, 
stats->dbname, share);
+                       if (out != NULL || strcmp(res, "OK") != 0) {
+                               res = out == NULL ? res : out;
+                               fprintf(stderr, "%s: %s\n", argv[0], res);
+                               state |= 1;
+                       }
+                       free(res);
                } else {
                        char *err;
                        readProps(props, stats->path);


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to