Changeset: 1ff61f9403f2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ff61f9403f2
Modified Files:
        clients/mapiclient/mclient.c
        clients/mapilib/mapi.mx
Branch: default
Log Message:

Removed MIL and XQUERY support from mclient and mapilib.
Support for client-side timers is still present, though commented out.


diffs (truncated from 948 to 300 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -102,9 +102,7 @@
 enum modes {
        NOLANGUAGE,
        MAL,
-       SQL,
-       XQUERY,
-       MIL
+       SQL
 };
 
 static enum modes mode = NOLANGUAGE;
@@ -143,9 +141,11 @@
 
 /* use a 64 bit integer for the timer */
 typedef lng timertype;
+#if 0
+static char *mark, *mark2;
+#endif
 
 static timertype t0, t1;       /* used for timing */
-static char *mark, *mark2;
 
 #define UTF8BOM                "\xEF\xBB\xBF"  /* UTF-8 encoding of Unicode 
BOM */
 #define UTF8BOMLENGTH  3       /* length of above */
@@ -292,10 +292,12 @@
        mnstr_flush(toConsole);
        t1 = gettime();
        assert(t1 >= t0);
-       if (mode == XQUERY && mark && specials == NOmodifier) {
+#if 0
+       if (mark && specials == NOmodifier) {
                fprintf(stderr, "%s %7ld.%03ld msec %s\n", mark, (long) ((t1 - 
t0) / 1000), (long) ((t1 - t0) % 1000), mark2 ? mark2 : "");
                fflush(stderr);
        }
+#endif
 }
 
 static timertype th = 0;
@@ -967,27 +969,12 @@
 RAWrenderer(MapiHdl hdl)
 {
        char *line;
-       size_t n;
 
        SQLqueryEcho(hdl);
        while ((line = fetch_line(hdl)) != 0) {
-               /* HACK to send also PF/XQuery break-down timings to stderr */
-               if (mode == XQUERY && mark && *line != '=' &&
-                   (n = strlen(line)) >= 22 &&  /* 7+10+5 */
-                   line[n-9] == '.' &&     /* decimal '.' */
-                   strncmp(line + n - 5, " msec", 5) == 0 &&
-                   (strncmp(line, "Trans  ", 7) == 0 ||
-                    strncmp(line, "Shred  ", 7) == 0 ||
-                    strncmp(line, "Query  ", 7) == 0 ||
-                    strncmp(line, "Print  ", 7) == 0 ||
-                    strncmp(line, "Update ", 7) == 0)) {
-                       mnstr_flush(toConsole);
-                       fprintf(stderr, "%s\n", line);
-               } else {
-                       if (*line == '=')
-                               line++;
-                       mnstr_printf(toConsole, "%s\n", line);
-               }
+               if (*line == '=')
+                       line++;
+               mnstr_printf(toConsole, "%s\n", line);
        }
 }
 
@@ -1061,9 +1048,11 @@
        int ps = rowsperpage, silent = 0;
        mapi_int64 rows = 0;
 
+#if 0
        if (mark2)
                free(mark2);
        mark2 = NULL;
+#endif
 
        croppedfields = 0;
        fields = mapi_get_field_count(hdl);
@@ -1249,7 +1238,9 @@
                SQLseparator(len, printfields, '-');
        rows = mapi_get_row_count(hdl);
        snprintf(buf, sizeof(buf), LLFMT " rows", rows);
-       mark2 = strdup(buf); /* for the timer output */
+#if 0
+       mark2 = strdup(buf);    /* for the timer output */
+#endif
        printf(LLFMT " tuple%s%s%s%s", rows, rows != 1 ? "s" : "",
                        singleinstr ? " (" : "",
                        singleinstr ? timerHuman() : "",
@@ -1282,20 +1273,13 @@
 }
 
 static void
-setFormatter(Mapi mid, char *s)
+setFormatter(char *s)
 {
 #ifdef WIN32
        if (formatter == TESTformatter)
                _set_output_format(0);
 #endif
-       if (mode == XQUERY) {
-               mapi_output(mid, s);
-               if (s != output) {
-                       if (output != NULL)
-                               free(output);
-                       output = strdup(s);
-               }
-       } else if (strcmp(s, "sql") == 0)
+       if (strcmp(s, "sql") == 0)
                formatter = TABLEformatter;
        else if (strcmp(s, "csv") == 0)
                formatter = CSVformatter;
@@ -1595,7 +1579,6 @@
        MapiHdl hdl = NULL;
        MapiMsg rc = MOK;
        int bufsize = 0;
-       int xquery_sep = 0;     /* we saw an XQuery separator (<>\n) */
        int first = 1;          /* first line processing */
        size_t skip;
 
@@ -1618,23 +1601,7 @@
        timerStart();
        do {
                timerPause();
-               if (mode == XQUERY) {
-                       /* In XQuery mode we must read one line at a
-                          time so that we can stop when we encounter
-                          a line with just "<>" on it. */
-                       if (fgets(buf, bufsize, fp) == NULL) {
-                               /* end of file */
-                               if (file != NULL) {
-                                       fclose(fp);
-                                       file = NULL;
-                               }
-                               length = 0;
-                               if (hdl == NULL)
-                                       break;  /* nothing more to do */
-                       } else {
-                               length = strlen(buf);
-                       }
-               } else if ((length = fread(buf, 1, bufsize, fp)) == 0) {
+               if ((length = fread(buf, 1, bufsize, fp)) == 0) {
                        /* end of file */
                        if (file != NULL) {
                                fclose(fp);
@@ -1664,16 +1631,14 @@
                else
                        skip = 0;
                first = 0;
-               xquery_sep = mode == XQUERY && length >= 3 + skip && buf[skip] 
== '<' && buf[skip + 1] == '>' && (buf[skip + 2] == '\n' || buf[skip + 2] == 
'\r');
-               if (length > skip && !xquery_sep) {
+               if (length > skip) {
                        assert(hdl != NULL);
 
                        mapi_query_part(hdl, buf + skip, length - skip);
                        CHECK_RESULT(mid, hdl, buf + skip, continue);
 
-                       /* in case of XQuery, do the whole file in one go;
-                          otherwise, make sure there is a newline in the 
buffer */
-                       if (mode == XQUERY || strchr(buf + skip, '\n') == NULL)
+                       /*  make sure there is a newline in the buffer */
+                       if (strchr(buf + skip, '\n') == NULL)
                                continue;
                }
 
@@ -1720,25 +1685,6 @@
 static void
 showCommands(void)
 {
-       /* XQuery prelude */
-       if (mode == XQUERY) {
-               mnstr_printf(toConsole, "mclient interactive MonetDB/XQuery 
session: type an XQuery or XQUF update.\n");
-               mnstr_printf(toConsole, "\nSupported document-management XQuery 
extensions:\n");
-               mnstr_printf(toConsole, " pf:collections() as node()\n");
-               mnstr_printf(toConsole, " pf:documents($collectionName as 
xs:string) as node()\n");
-               mnstr_printf(toConsole, " pf:del-doc($documentName as 
xs:string)\n");
-               mnstr_printf(toConsole, " pf:add-doc($uri as xs:string, 
$documentName as xs:string\n");
-               mnstr_printf(toConsole, "     [,$collectionName as xs:string 
[,$freePercentage as xs:integer]])\n");
-               mnstr_printf(toConsole, "\nSession commands:\n");
-               mnstr_printf(toConsole, "<>      - send query to server (or 
%s)\n",
-#ifdef WIN32
-                             "CTRL-Z"
-#else
-                             "CTRL-D"
-#endif
-                   );
-       }
-
        /* shared control options */
        mnstr_printf(toConsole, "\\?      - show this message\n");
        if (mode == MAL)
@@ -1756,18 +1702,10 @@
                mnstr_printf(toConsole, "\\A      - enable auto commit\n");
                mnstr_printf(toConsole, "\\a      - disable auto commit\n");
        }
-       if (mode == XQUERY) {
-               mnstr_printf(toConsole, "\\G      - switch to algebra 
frontend\n");
-               mnstr_printf(toConsole, "\\g      - switch to old frontend\n");
-       }
-       if (mode == XQUERY) {
-               mnstr_printf(toConsole, "\\f      - result format: dm or 
xml[-noheader][-typed|-noroot|-root-FOOBAR]\n");
-       } else {
-               mnstr_printf(toConsole, "\\e      - echo the query in sql 
formatting mode\n");
-               mnstr_printf(toConsole, "\\f      - format using a built-in 
renderer {csv,tab,raw,sql,xml}\n");
-               mnstr_printf(toConsole, "\\w#     - set maximal page width 
(-1=unlimited, 0=terminal width, >0=limit to num)\n");
-               mnstr_printf(toConsole, "\\r#     - set maximum rows per page 
(-1=raw)\n");
-       }
+       mnstr_printf(toConsole, "\\e      - echo the query in sql formatting 
mode\n");
+       mnstr_printf(toConsole, "\\f      - format using a built-in renderer 
{csv,tab,raw,sql,xml}\n");
+       mnstr_printf(toConsole, "\\w#     - set maximal page width 
(-1=unlimited, 0=terminal width, >0=limit to num)\n");
+       mnstr_printf(toConsole, "\\r#     - set maximum rows per page 
(-1=raw)\n");
        mnstr_printf(toConsole, "\\L file - save client/server interaction\n");
        mnstr_printf(toConsole, "\\X      - trace mclient code\n");
        mnstr_printf(toConsole, "\\q      - terminate session\n");
@@ -1895,8 +1833,7 @@
                            strncmp(line, UTF8BOM, UTF8BOMLENGTH) == 0)
                        line += UTF8BOMLENGTH;  /* skip Byte Order Mark (BOM) */
                lineno++;
-               if (line == NULL ||
-                   (mode == XQUERY && line[0] == '<' && line[1] == '>')) {
+               if (line == NULL) {
                        /* end of file */
                        if (hdl == NULL) {
                                if (line != NULL)
@@ -1935,16 +1872,14 @@
                                case 'q':
                                        free(buf);
                                        return errseen;
+#if 0
                                case 't':
-                                       if (mode != XQUERY)
-                                               break;
                                        mark = mark ? NULL : "Timer";
                                        if (mark2)
                                                free(mark2);
                                        mark2 = strdup(line + 2);
-                                       if (mode == XQUERY)
-                                               mapi_profile(mid, mark != NULL);
                                        continue;
+#endif
                                case 'X':
                                        /* toggle interaction trace */
                                        mapi_trace(mid, !mapi_get_trace(mid));
@@ -1959,16 +1894,6 @@
                                                break;
                                        mapi_setAutocommit(mid, 0);
                                        continue;
-                               case 'G':
-                                       if (mode != XQUERY)
-                                               break;
-                                       mapi_setAlgebra(mid, 1);
-                                       continue;
-                               case 'g':
-                                       if (mode != XQUERY)
-                                               break;
-                                       mapi_setAlgebra(mid, 0);
-                                       continue;
                                case 'w':
                                        pagewidth = atoi(line + 2);
                                        pagewidthset = pagewidth != 0;
@@ -2360,35 +2285,31 @@
                                                ;
                                        if (*line == 0) {
                                                mnstr_printf(toConsole, 
"Current formatter: ");
-                                               if (mode == XQUERY)
-                                                       mnstr_printf(toConsole, 
"%s\n", output == NULL ? "dm" : output);
-                                               else {
-                                                       switch (formatter) {
-                                                       case RAWformatter:
-                                                               
mnstr_printf(toConsole, "raw\n");
-                                                               break;
-                                                       case TABLEformatter:
-                                                               
mnstr_printf(toConsole, "sql\n");
-                                                               break;
-                                                       case CSVformatter:
-                                                               
mnstr_printf(toConsole, "csv\n");
-                                                               break;
-                                                       case TABformatter:
-                                                               
mnstr_printf(toConsole, "tab\n");
-                                                               break;
-                                                       case TESTformatter:
-                                                               
mnstr_printf(toConsole, "test\n");
-                                                               break;
-                                                       case XMLformatter:
-                                                               
mnstr_printf(toConsole, "xml\n");
-                                                               break;
-                                                       default:
-                                                               
mnstr_printf(toConsole, "none\n");
-                                                               break;
-                                                       }
+                                               switch (formatter) {
+                                               case RAWformatter:
+                                                       mnstr_printf(toConsole, 
"raw\n");
+                                                       break;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to