Changeset: 0c1cff6d415e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0c1cff6d415e
Modified Files:
        clients/mapilib/mapi.c
        clients/mapilib/mapi.h
        sql/backends/monet5/sql_scenario.c
Branch: mapihandshake
Log Message:

Also pass the columnar_protocol boolean


diffs (64 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2835,6 +2835,9 @@ mapi_reconnect(Mapi mid)
        if (mid->handshake_options > MAPI_HANDSHAKE_SIZE_HEADER) {
                CHECK_SNPRINTF(",size_header=%d", mid->sizeheader); // with 
underscore, despite X command without
        }
+       if (mid->handshake_options > MAPI_HANDSHAKE_COLUMNAR_PROTOCOL) {
+               CHECK_SNPRINTF(",columnar_protocol=%d", mid->columnar_protocol);
+       }
        if (mid->handshake_options > MAPI_HANDSHAKE_TIME_ZONE) {
                CHECK_SNPRINTF(",time_zone=%d", mid->time_zone);
        }
@@ -3060,6 +3063,9 @@ mapi_reconnect(Mapi mid)
                if (result != MOK)
                        return mid->error;
        }
+       // There is no if  (mid->handshake_options <= 
MAPI_HANDSHAKE_COLUMNAR_PROTOCOL && mid->columnar_protocol != 
MapiStructDefaults.columnar_protocol)
+       // The reason is that columnar_protocol is very new. If it isn't 
supported in the handshake it isn't supported at
+       // all so sending the Xcommand would just give an error.
        if (mid->handshake_options <= MAPI_HANDSHAKE_TIME_ZONE) {
                mapi_set_time_zone(mid, mid->time_zone);
        }
@@ -3789,6 +3795,8 @@ mapi_set_columnar_protocol(Mapi mid, boo
        if (mid->columnar_protocol == columnar_protocol)
                return MOK;
        mid->columnar_protocol = columnar_protocol;
+       if (!mid->connected)
+               return MOK;
        if (columnar_protocol)
                return mapi_Xcommand(mid, "columnar_protocol", "1");
        else
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -29,10 +29,12 @@ typedef int MapiMsg;
 
 enum mapi_handshake_options_levels {
        MAPI_HANDSHAKE_AUTOCOMMIT = 1,
-       MAPI_HANDSHAKE_REPLY_SIZE,
-       MAPI_HANDSHAKE_SIZE_HEADER,
-       MAPI_HANDSHAKE_TIME_ZONE,
-       // this must always be the last one:
+       MAPI_HANDSHAKE_REPLY_SIZE = 2,
+       MAPI_HANDSHAKE_SIZE_HEADER = 3,
+       MAPI_HANDSHAKE_COLUMNAR_PROTOCOL = 4,
+       MAPI_HANDSHAKE_TIME_ZONE = 5,
+       // make sure to insert new option levels before this one.
+       // it is the value sent by the server during the initial handshake.
        MAPI_HANDSHAKE_OPTIONS_LEVEL,
 };
 
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
@@ -296,6 +296,8 @@ SQLprepareClient(Client c, int login)
                                m->reply_size = value;
                        } else if (sscanf(tok, "size_header=%d", &value) == 1) {
                                        be->sizeheader = value != 0;
+                       } else if (sscanf(tok, "columnar_protocol=%d", &value) 
== 1) {
+                               c->protocol = (value != 0) ? PROTOCOL_COLUMNAR 
: PROTOCOL_9;
                        } else if (sscanf(tok, "time_zone=%d", &value) == 1) {
                                m->timezone = 1000 * value;
                        } else {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to