Changeset: 96faff1dd7f2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=96faff1dd7f2
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/modules/mal/remote.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_execute.c
Branch: monetdbe-proxy
Log Message:

Set result set protocol via MAL call.


diffs (112 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1665,6 +1665,7 @@ str setVariableRef;
 void setVariableScope(MalBlkPtr mb);
 void setVariableType(MalBlkPtr mb, const int idx, malType type);
 str setWriteModeRef;
+str set_protocolRef;
 void setprofilerlimit(int limit);
 void showAllScenarios(stream *f);
 void showCurrentScenario(void);
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -246,9 +246,11 @@ static str RMTconnectScen(
                return msg;
        }
 
-       if (columnar && (mapi_set_columnar_protocol(m, true) != MOK || 
mapi_error(m))) {
-               msg = createException(MAL, "monetdbe.connect", "%s", 
mapi_error_str(m));
-               return msg;
+       if (columnar) {
+               char set_protocol_query_buf[50];
+               snprintf(set_protocol_query_buf, 50, 
"sql.set_protocol(%d:int);", PROTOCOL_COLUMNAR);
+               if ((msg = RMTquery(&hdl, "remote.connect", m, 
set_protocol_query_buf)))
+                       return msg;
        }
 
        /* connection established, add to list */
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -270,6 +270,7 @@ str seriesRef;
 str setAccessRef;
 str setVariableRef;
 str setWriteModeRef;
+str set_protocolRef;
 str singleRef;
 str sinkRef;
 str sliceRef;
@@ -577,6 +578,7 @@ void optimizerInit(void)
        setAccessRef = putName("setAccess");
        setVariableRef = putName("setVariable");
        setWriteModeRef= putName("setWriteMode");
+       set_protocolRef= putName("set_protocol");
        singleRef = putName("single");
        sinkRef = putName("sink");
        sliceRef = putName("slice");
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -269,6 +269,7 @@ mal_export  str seriesRef;
 mal_export  str setAccessRef;
 mal_export  str setVariableRef;
 mal_export  str setWriteModeRef;
+mal_export  str set_protocolRef;
 mal_export  str singleRef;
 mal_export  str sinkRef;
 mal_export  str sliceRef;
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -281,6 +281,28 @@ SQLshutdown_wrap(Client cntxt, MalBlkPtr
        return msg;
 }
 
+static str
+SQLset_protocol(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       const int protocol = *getArgReference_int(stk, pci, 1);
+
+       (void) mb;
+       (void) stk;
+
+       if (!(
+               protocol == PROTOCOL_AUTO ||
+               protocol == PROTOCOL_9 ||
+               protocol == PROTOCOL_10 ||
+               protocol == PROTOCOL_COLUMNAR))
+       {
+               return createException(SQL, "sql.set_protocol", "unknown 
protocol: %d", protocol);
+       }
+
+       *getArgReference_int(stk, pci, 0) = (cntxt->protocol = protocol);
+
+       return MAL_SUCCEED;
+}
+
 str
 create_table_or_view(mvc *sql, char* sname, char *tname, sql_table *t, int 
temp)
 {
@@ -5472,6 +5494,7 @@ static mel_func sql_init_funcs[] = {
  pattern("sql", "shutdown", SQLshutdown_wrap, false, "", args(1,2, 
arg("",str),arg("delay",bte))),
  pattern("sql", "shutdown", SQLshutdown_wrap, false, "", args(1,2, 
arg("",str),arg("delay",sht))),
  pattern("sql", "shutdown", SQLshutdown_wrap, false, "", args(1,2, 
arg("",str),arg("delay",int))),
+ pattern("sql", "set_protocol", SQLset_protocol, true, "Configures the result 
set protocol", args(1,2, arg("",int), arg("protocol",int))),
  pattern("sql", "mvc", SQLmvc, false, "Get the multiversion catalog context. 
\nNeeded for correct statement dependencies\n(ie sql.update, should be after 
sql.bind in concurrent execution)", args(1,1, arg("",int))),
  pattern("sql", "transaction", SQLtransaction2, true, "Start an autocommit 
transaction", noargs),
  pattern("sql", "commit", SQLcommit, true, "Trigger the commit operation for a 
MAL block", noargs),
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -349,8 +349,8 @@ SQLstatementIntern(Client c, const char 
                throw(SQL, "sql.statement", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
        *o = *m;
+       /* hide query cache, this causes crashes in SQLtrans() due to 
uninitialized memory otherwise */
        struct qc* qc = m->qc;
-       /* hide query cache, this causes crashes in SQLtrans() due to 
uninitialized memory otherwise */
        m->qc = NULL;
 
        /* create private allocator */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to