Changeset: 0eb02f97a5ab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0eb02f97a5ab
Modified Files:
        monetdb5/modules/mal/mal_mapi.c
        sql/backends/monet5/sql_scenario.c
Branch: clientinfo
Log Message:

Accept Xclientinfo command


diffs (42 lines):

diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -225,7 +225,7 @@ doChallenge(void *data)
        /* Send the challenge over the block stream
         * We can do binary transfers, and we can interrupt queries using
         * out-of-band messages */
-       mnstr_printf(fdout, "%s:mserver:9:%s:%s:%s:sql=%d:BINARY=1:OOBINTR=1:",
+       mnstr_printf(fdout, 
"%s:mserver:9:%s:%s:%s:sql=%d:BINARY=1:OOBINTR=1:CLIENTINFO:",
                                 challenge, mcrypt_getHashAlgorithms(),
 #ifdef WORDS_BIGENDIAN
                                 "BIG",
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1205,6 +1205,26 @@ SQLchannelcmd(Client c, backend *be)
                in->pos = in->len;      /* HACK: should use parsed length */
                return MAL_SUCCEED;
        }
+       if (strncmp(in->buf + in->pos, "clientinfo\n", 11) == 0) {
+               in->pos += 11;
+               char *end = in->buf + in->len;
+               char *key = in->buf + in->pos;
+               while (key < end) {
+                       char *p = memchr(key, '\n', end - key);
+                       if (!p)
+                               return createException(SQL, "SQLparser", 
SQLSTATE(42000) "no trailing newline in clientinfo");
+                       *p = '\0';
+                       char *q = memchr(key, '=', p - key);
+                       if (!q)
+                               return createException(SQL, "SQLparser", 
SQLSTATE(42000) "found no = in clientinfo");
+                       *q = '\0';
+                       char *value = q + 1;
+                       MCsetClientInfo(c, key, *value ? value : NULL);
+                       key = p + 1;
+               }
+               in->pos = in->len;
+               return MAL_SUCCEED;
+       }
        if (strncmp(in->buf + in->pos, "quit", 4) == 0) {
                c->mode = FINISHCLIENT;
                in->pos = in->len;      /* HACK: should use parsed length */
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to