Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16:/tmp/cvs-serv3115/src/backends/monet5

Modified Files:
        Makefile.ag embeddedclient.mx prog.c sql_gencode.mx 
        sql_scenario.mx 
Log Message:
propagated changes of Thursday Apr 12 2007 - Friday Apr 27 2007
from the SQL_2-16 branch to the development trunk


Index: sql_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_scenario.mx,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -d -r1.258 -r1.259
--- sql_scenario.mx     17 Apr 2007 17:09:37 -0000      1.258
+++ sql_scenario.mx     27 Apr 2007 09:45:50 -0000      1.259
@@ -150,6 +150,8 @@
        /* s->optimizer = "SQLoptimizer";
         * s->tactics = .. */
        s->engine = "SQLengine";
+       if (GDKembedded)
+               return MAL_SUCCEED;
        tmp = SABAOTHmarchScenario(&res, &s->name);
        if (tmp != MAL_SUCCEED)
                return(tmp);
@@ -186,7 +188,9 @@
        }
        /* this function is never called, but for the style of it, we clean
         * up our own mess */
-       return SABAOTHretreatScenario(&res, &s);
+       if (!GDKembedded)
+               return SABAOTHretreatScenario(&res, &s);
+       return MAL_SUCCEED;
 }
 
 str

Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/Makefile.ag,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- Makefile.ag 7 Apr 2007 21:09:08 -0000       1.41
+++ Makefile.ag 27 Apr 2007 09:45:50 -0000      1.42
@@ -33,19 +33,19 @@
 }
 
 
-#lib_embeddedsql5 = {
-       #SOURCES = embeddedclient.mx
-       #LIBS = ../../server/libsqlserver ../../storage/bat/libbatstore 
../../common/libsqlcommon \
-               #$(MONETDB5_MODS) -l_logger -l_bat5 -l_tablet $(MONETDB5_LIBS) 
-lmal \
-               #$(CLIENTS_LIBS) $(MONETDB_LIBS) -lbat -lMapi -lmutils -lstream 
$(READLINE_LIBS) $(PTHREAD_LIBS)
-#}
+lib_embeddedsql5 = {
+       SOURCES = embeddedclient.mx
+       LIBS = ../../server/libsqlserver ../../storage/bat/libbatstore 
../../common/libsqlcommon \
+               $(MONETDB5_MODS) -l_logger -l_bat5 -l_tablet $(MONETDB5_LIBS) 
-lmal \
+               $(CLIENTS_LIBS) $(MONETDB_LIBS) -lbat -lMapi -lmutils -lstream 
$(READLINE_LIBS) $(PTHREAD_LIBS)
+}
 
-#bin_Mbeddedsql5 = {
-       #SOURCES = prog.c
-       #LIBS = libembeddedsql5 ../../server/libsqlserver 
../../storage/bat/libbatstore ../../common/libsqlcommon \
-               #$(MONETDB5_MODS) -l_logger -l_bat5 -l_tablet $(MONETDB5_LIBS) 
-lmal \
-               #$(CLIENTS_LIBS) $(MONETDB_LIBS) -lbat -lMapi -lmutils -lstream 
$(READLINE_LIBS) $(PTHREAD_LIBS)
-#}
+bin_Mbeddedsql5 = {
+       SOURCES = prog.c
+       LIBS = libembeddedsql5 ../../server/libsqlserver 
../../storage/bat/libbatstore ../../common/libsqlcommon \
+               $(MONETDB5_MODS) -l_logger -l_bat5 -l_tablet $(MONETDB5_LIBS) 
-lmal \
+               $(CLIENTS_LIBS) $(MONETDB_LIBS) -lbat -lMapi -lmutils -lstream 
$(READLINE_LIBS) $(PTHREAD_LIBS)
+}
 
 
 scripts_mal = {

Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -d -r1.242 -r1.243
--- sql_gencode.mx      26 Apr 2007 14:35:07 -0000      1.242
+++ sql_gencode.mx      27 Apr 2007 09:45:50 -0000      1.243
@@ -1523,6 +1523,7 @@
                                q = pushArgument(mb, q, file);
                                q = pushStr(mb, q, "UTF-8");
                                q = pushArgument(mb, q, codeset);
+                               file = getDestVar(q);
 
                                q = newStmt(mb, "streams", "openRead");
                                q = pushArgument(mb, q, file);
@@ -1541,11 +1542,11 @@
                                q = pushInt(mb, q, s->flag);
                                s->nr = getDestVar(q);
 
-                               q = newStmt(mb, "streams", "close");
-                               q = pushArgument(mb, q, file);
-
                                q = newStmt(mb, "bstream", "destroy");
                                q = pushArgument(mb, q, bs);
+
+                               q = newStmt(mb, "streams", "close");
+                               q = pushArgument(mb, q, file);
                        } else {
                                int io_stdin;
                                q = newStmt(mb, "io", "stdin");

Index: prog.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/prog.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- prog.c      3 Jan 2007 12:39:25 -0000       1.5
+++ prog.c      27 Apr 2007 09:45:50 -0000      1.6
@@ -16,6 +16,7 @@
  * All Rights Reserved.
  */
 
+#include <mal_config.h>
 #include <monet_options.h>
 #include "embeddedclient.h"
 
@@ -96,7 +97,7 @@
        if (!(setlen = mo_builtin_settings(&set)))
                usage(prog);
 
-       /* needed, to prevent the MonetDB/4 config file to be used */  
+       /* needed, to prevent the MonetDB config file to be used */  
        setlen = mo_add_option(&set, setlen, opt_config, "prefix", 
MONETDBPREFIX);
        setlen = mo_add_option(&set, setlen, opt_config, "config", 
MONETDBCONFIG);
        setlen = mo_system_config(&set, setlen);

Index: embeddedclient.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/embeddedclient.mx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- embeddedclient.mx   19 Jan 2007 14:41:54 -0000      1.10
+++ embeddedclient.mx   27 Apr 2007 09:45:50 -0000      1.11
@@ -35,24 +35,7 @@
 #ifndef _EMBEDDEDCLIENT_H_
 #define _EMBEDDEDCLIENT_H_
 
-#include "mal_config.h"
-#include "gdk.h"
-#ifdef HAVE_PTHREAD_H
-/* pthread.h on Windows includes config.h if HAVE_CONFIG_H is set */
-#undef HAVE_CONFIG_H
-#ifdef pid_t
-#undef pid_t
-#endif
-#include <sched.h>
-#include <pthread.h>
-#endif
-
 #include "monet_options.h"
-#include "mal.h"
-#include "mal_session.h"
-#include "mal_import.h"
-#include "mal_client.h"
-#include "mal_function.h"
 
 #ifdef WIN32
 #ifndef LIBEMBEDDEDSQL5
@@ -73,7 +56,23 @@
 @c
 #include "sql_config.h"
 #include "embeddedclient.h"
-#include "mserver.h"
+
+#include "gdk.h"
+#ifdef HAVE_PTHREAD_H
+/* pthread.h on Windows includes config.h if HAVE_CONFIG_H is set */
+#undef HAVE_CONFIG_H
+#ifdef pid_t
+#undef pid_t
+#endif
+#include <sched.h>
+#include <pthread.h>
+#endif
+
+#include "mal.h"
+#include "mal_session.h"
+#include "mal_import.h"
+#include "mal_client.h"
+#include "mal_function.h"
 
 static void
 Monet_init(opt *set, int setlen)
@@ -134,16 +133,12 @@
                GDK_mem_bigsize = strtol(p, NULL, 10);
        if ((p = GDKgetenv("gdk_vm_minsize")) != NULL)
                GDK_vm_minsize = strtol(p, NULL, 10);
-       if (GDKgetenv_isyes("gdk_embedded")) {
-               GDKembedded = 1;
-       }
-
        if (GDKgetenv_isyes("monet_daemon"))
                monet_daemon = 1;
-       if (GDKgetenv_isyes("monet_embedded")) {
-               monet_daemon = 1;
-               GDKembedded = 1;
-       }
+
+       GDKsetenv("gdk_embedded", "yes");
+       GDKsetenv("monet_embedded", "yes");
+       GDKembedded = 1;
 }
 
 static opt *embedded_set = NULL;
@@ -160,10 +155,6 @@
 /*             monet_singlethreaded = 1; */
                if (embedded_set == NULL) {
                        int len = mo_builtin_settings(&embedded_set);
-
-                       len = mo_add_option(&embedded_set, len, opt_config, 
"prefix", MONETDBPREFIX);
-                       len = mo_add_option(&embedded_set, len, opt_config, 
"config", MONETDBCONFIG);
-
                        embedded_len = mo_system_config(&embedded_set, len);
                }
                Monet_init(embedded_set, embedded_len);
@@ -171,6 +162,29 @@
                mo_free_options(embedded_set, embedded_len);
                if (mal_init())
                        return 0;
+               {
+                       /* unlock the vault, first see if we can find the file 
which
+                        * holds the secret */
+                       char* secret = alloca(sizeof(char) * 1024);
+                       FILE* secretf;
+                       size_t len;
+                       
+                       if (GDKgetenv("monet_vault_key") == NULL) {
+                               /* use a default (hard coded, non safe) key */
+                               secret = "Xas632jsi2whjds8";
+                       } else {
+                               if ((secretf = 
fopen(GDKgetenv("monet_vault_key"), "r")) == NULL) 
+                                       return 0;
+                               len = fread(secret, 1, 1023, secretf);
+                               secret[len] = '\0';
+                               fclose(secretf);
+                       }
+                       if (AUTHunlockVault(&secret) != MAL_SUCCEED)
+                               return 0;
+               }
+               /* make sure the authorisation BATs are loaded */
+               if (AUTHinitTables() != MAL_SUCCEED)
+                       return 0;
                MSinitClientPrg(mal_clients, "user","main");
                initialized = 1;
        }
@@ -180,9 +194,9 @@
        free(arg);
        snprintf(buf, sizeof(buf), 
                "include sql;\n"
-               "in  := \"" PTRFMT "\":stream;\n"
-               "out := \"" PTRFMT "\":stream;\n"
-               "mapi.malclient(in, out);\n", PTRFMTCAST in, PTRFMTCAST out);
+               "in  := \"" PTRFMT "\":streams;\n"
+               "out := \"" PTRFMT "\":streams;\n"
+               "mserver.malclient(in, out);\n", PTRFMTCAST in, PTRFMTCAST out);
        callString(mal_clients, buf, 0);
        return NULL;
 }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to