Changeset: de2aabb26e8e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=de2aabb26e8e
Modified Files:
        sql/backends/monet5/sql_scenario.c
Branch: transaction-replication
Log Message:

Run the SQLinitClient only if the store is not read-only
Modify SQLinitClient signature to take a readonly parameter.


diffs (56 lines):

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
@@ -126,12 +126,13 @@ SQLsession2(Client cntxt, MalBlkPtr mb, 
        return msg;
 }
 
-static str SQLinit(void);
+static str SQLinit(int readonly);
 
 str
 SQLprelude(void)
 {
        str tmp;
+       int readonly = GDKgetenv_isyes("gdk_readonly");
        Client c;
 
        Scenario ms, s = getFreeScenario();
@@ -165,16 +166,19 @@ SQLprelude(void)
        ms->engine = "MALengine";
 
        /* init the SQL store */
-       tmp = SQLinit();
+
+       tmp = SQLinit(readonly);
        if (tmp != MAL_SUCCEED) {
                return (tmp);
        }
 
-       /* init the client as well */
-       c = mal_clients; /* run as admin in SQL mode*/
-       tmp = SQLinitClient(c);
-       if (tmp != MAL_SUCCEED) {
-               return (tmp);
+       /* init the client as well if this is not a read-only DB*/
+       if (!readonly) {
+               c = mal_clients; /* run as admin in SQL mode*/
+               tmp = SQLinitClient(c);
+               if (tmp != MAL_SUCCEED) {
+                       return (tmp);
+               }
        }
 
        fprintf(stdout, "# MonetDB/SQL module loaded\n");
@@ -211,10 +215,9 @@ SQLepilogue(void)
 MT_Id sqllogthread, minmaxthread;
 
 static str
-SQLinit(void)
+SQLinit(int readonly)
 {
        char *debug_str = GDKgetenv("sql_debug"), *msg = MAL_SUCCEED;
-       int readonly = GDKgetenv_isyes("gdk_readonly");
        int single_user = GDKgetenv_isyes("gdk_single_user");
        const char *gmt = "GMT";
        tzone tz;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to