Changeset: 798985dc04ad for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=798985dc04ad
Modified Files:
        
Branch: default
Log Message:

Merged from Aug2011


diffs (162 lines):

diff --git a/clients/mapiclient/Tests/mclient--help.stable.err.Windows 
b/clients/mapiclient/Tests/mclient--help.stable.err.Windows
--- a/clients/mapiclient/Tests/mclient--help.stable.err.Windows
+++ b/clients/mapiclient/Tests/mclient--help.stable.err.Windows
@@ -26,6 +26,7 @@ Options are:
  -L logfile  | --log=logfile     save client/server interaction
  -s stmt     | --statement=stmt  run single statement
  -X          | --Xdebug          trace mapi network interaction
+ -z          | --timezone         do not tell server our timezone
  -?          | --help             show this usage message
 
 SQL specific opions 
diff --git a/clients/odbc/driver/SQLProcedures.c 
b/clients/odbc/driver/SQLProcedures.c
--- a/clients/odbc/driver/SQLProcedures.c
+++ b/clients/odbc/driver/SQLProcedures.c
@@ -90,19 +90,20 @@ SQLProcedures_(ODBCStmt *stmt,
        query_end = query;
 
        snprintf(query_end, 1000,
-                "select "
-                "cast(null as varchar(1)) as \"procedure_cat\", "
-                "\"s\".\"name\" as \"procedure_schem\", "
-                "\"p\".\"name\" as \"procedure_name\", "
-                "0 as \"num_input_params\", "
-                "0 as \"num_output_params\", "
-                "0 as \"num_result_sets\", "
-                "cast('' as varchar(1)) as \"remarks\", "
-                "cast(%d as smallint) as \"procedure_type\" "
-                "from sys.\"functions\" as \"p\", sys.\"schemas\" as \"s\" "
-                "where \"p\".\"schema_id\" = \"s\".\"id\" "
-                "and \"p\".\"sql\" = true ",
-                SQL_PT_UNKNOWN);
+                "select cast(null as varchar(1)) as \"procedure_cat\","
+                "       \"s\".\"name\" as \"procedure_schem\","
+                "       \"p\".\"name\" as \"procedure_name\","
+                "       0 as \"num_input_params\","
+                "       0 as \"num_output_params\","
+                "       0 as \"num_result_sets\","
+                "       cast('' as varchar(1)) as \"remarks\","
+                "       cast(case when \"a\".\"name\" is null then %d else %d 
end as smallint) as \"procedure_type\""
+                "from \"sys\".\"schemas\" as \"s\","
+                "     \"sys\".\"functions\" as \"p\" left outer join 
\"sys\".\"args\" as \"a\""
+                "             on \"p\".\"id\" = \"a\".\"func_id\" and 
\"a\".\"name\" = 'result'"
+                "where \"p\".\"schema_id\" = \"s\".\"id\" and"
+                "      \"p\".\"sql\" = true",
+                SQL_PT_PROCEDURE, SQL_PT_FUNCTION);
        query_end += strlen(query_end);
 
        /* Construct the selection condition query part */
@@ -175,7 +176,7 @@ SQLProcedures_(ODBCStmt *stmt,
 
        /* add the ordering */
        strcpy(query_end,
-              "order by \"procedure_cat\", \"procedure_schem\", 
\"procedure_name\"");
+              " order by \"procedure_cat\", \"procedure_schem\", 
\"procedure_name\"");
        query_end += strlen(query_end);
 
        /* query the MonetDB data dictionary tables */
diff --git a/tools/merovingian/ChangeLog.Aug2011 
b/tools/merovingian/ChangeLog.Aug2011
--- a/tools/merovingian/ChangeLog.Aug2011
+++ b/tools/merovingian/ChangeLog.Aug2011
@@ -1,6 +1,14 @@
 # ChangeLog file for sql/src/backends/monet5/merovingian
 # This file is updated with mchangelog
 
+* Fri Aug 19 2011 Fabian Groffen <fab...@cwi.nl>
+- The path to the mserver5 binary is no longer returned for the mserver
+  property with monetdbd get for a dbfarm which is currently served by
+  a monetdbd.  Since the called monetdbd needs not to be the same as
+  the running monetdbd, the reported mserver5 binary may be incorrect,
+  and obviously lead to confusing situations.  Refer to the running
+  monetdbd's logfile to determine the mserver5 binary location instead.
+
 * Wed Aug 17 2011 Fabian Groffen <fab...@cwi.nl>
 - Added -n option to monetdbd start command, which prevents monetdbd
   from forking into the background.
diff --git a/tools/merovingian/daemon/argvcmds.c 
b/tools/merovingian/daemon/argvcmds.c
--- a/tools/merovingian/daemon/argvcmds.c
+++ b/tools/merovingian/daemon/argvcmds.c
@@ -153,6 +153,7 @@ command_get(confkeyval *ckv, int argc, c
        char buf[512];
        char vbuf[512];
        confkeyval *kv;
+       int meropid = -1;
 
        if (argc < 2 || argc > 3) {
                command_help(2, &argv[-1]);
@@ -194,13 +195,40 @@ command_get(confkeyval *ckv, int argc, c
                return(1);
        }
 
+       if (strstr(property, "status") != NULL ||
+                       strstr(property, "mserver") != NULL)
+       {
+               /* check if there is a merovingian serving this dbfarm */
+               int ret;
+               if ((ret = MT_lockf(".merovingian_lock", F_TLOCK, 4, 1)) == -1) 
{
+                       /* locking failed, merovingian is running */
+                       FILE *pf;
+                       char *pfile = getConfVal(ckv, "pidfile");
+
+                       if (pfile != NULL && (pf = fopen(pfile, "r")) != NULL &&
+                                       fgets(buf, sizeof(buf), pf) != NULL)
+                       {
+                               meropid = atoi(buf);
+                       }
+               } else {
+                       if (ret >= 0)
+                               close(ret); /* release a possible lock */
+                       meropid = 0;
+               }
+       }
+
        printf("   property            value\n");
        while ((p = strtok(property, ",")) != NULL) {
                property = NULL;
                if (strcmp(p, "dbfarm") == 0) {
                        value = dbfarm;
                } else if (strcmp(p, "mserver") == 0) {
-                       value = _mero_mserver;
+                       if (meropid == 0) {
+                               value = _mero_mserver;
+                       } else {
+                               value = "binary in use cannot be determined "
+                                       "for a running monetdbd";
+                       }
                } else if (strcmp(p, "hostname") == 0) {
                        value = _mero_hostname;
                } else if (strcmp(p, "mapisock") == 0) {
@@ -218,26 +246,14 @@ command_get(confkeyval *ckv, int argc, c
                                        value, kv->ival);
                        value = buf;
                } else if (strcmp(p, "status") == 0) {
-                       /* check if there is a merovingian serving this dbfarm 
*/
-                       int ret;
-                       if ((ret = MT_lockf(".merovingian_lock", F_TLOCK, 4, 
1)) == -1) {
-                               /* locking failed, merovingian is running */
-                               FILE *pf;
-                               char *pfile = getConfVal(ckv, "pidfile");
-
-                               if (pfile != NULL && (pf = fopen(pfile, "r")) 
!= NULL &&
-                                               fgets(buf, sizeof(buf), pf) != 
NULL)
-                               {
-                                       int meropid = atoi(buf);
-                                       snprintf(buf, sizeof(buf), 
"monetdbd[%d] is serving this dbfarm", meropid);
-                                       value = buf;
-                               } else {
-                                       value = "a monetdbd is serving this 
dbfarm, "
-                                               "but a pidfile was not found/is 
corrupt";
-                               }
+                       if (meropid > 0) {
+                               snprintf(buf, sizeof(buf),
+                                               "monetdbd[%d] is serving this 
dbfarm", meropid);
+                               value = buf;
+                       } else if (meropid < 0) {
+                               value = "a monetdbd is serving this dbfarm, "
+                                       "but a pidfile was not found/is 
corrupt";
                        } else {
-                               if (ret >= 0)
-                                       close(ret); /* release a possible lock 
*/
                                value = "no monetdbd is serving this dbfarm";
                        }
                } else {
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to