Changeset: 850d797d30c8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=850d797d30c8
Modified Files:
MonetDB5/src/mal/mal_import.mx
MonetDB5/src/mal/mal_linker.mx
sql/src/backends/monet5/sql.mx
sql/src/backends/monet5/sql_scenario.mx
Branch: default
Log Message:
manually align default with Jun2010 branch
diffs (149 lines):
diff -r ecc5fdbf2fe6 -r 850d797d30c8 MonetDB5/src/mal/mal_import.mx
--- a/MonetDB5/src/mal/mal_import.mx Thu May 13 10:02:00 2010 +0200
+++ b/MonetDB5/src/mal/mal_import.mx Thu May 13 19:55:07 2010 +0200
@@ -75,6 +75,7 @@
malOpenSource(str file)
{
stream *fd = NULL;
+
if (file)
fd = open_rastream(file);
return fd;
@@ -242,9 +243,9 @@
evalFile(Client c, str fname, int listing){
@:restoreState@
stream *fd;
- str msg= MAL_SUCCEED;
str p;
str filename;
+ str msg= MAL_SUCCEED;
c->prompt = GDKstrdup(""); /* do not produce visible prompts */
c->promptlength = 0;
diff -r ecc5fdbf2fe6 -r 850d797d30c8 MonetDB5/src/mal/mal_linker.mx
--- a/MonetDB5/src/mal/mal_linker.mx Thu May 13 10:02:00 2010 +0200
+++ b/MonetDB5/src/mal/mal_linker.mx Thu May 13 19:55:07 2010 +0200
@@ -65,6 +65,7 @@
#define MONET64 1
mal_export MALfcn getAddress(str filename, str modnme, str fcnname,int silent);
mal_export char *MSP_locate_script(const char *mod_name);
+mal_export char *MSP_locate_sqlscript(const char *mod_name);
mal_export char *MSP_locate_file(const char *mod_name);
mal_export str loadLibrary(str modulename, int flag);
mal_export void unloadLibraries(void);
@@ -430,6 +431,13 @@
}
char *
+MSP_locate_sqlscript(const char *filename)
+{
+ /* no directory semantics (yet) */
+ return locate_file(filename, SQL_EXT, 0);
+}
+
+char *
MSP_locate_file(const char *filename)
{
char *lib_name = GDKmalloc(strlen(filename) + strlen(SO_PREFIX) + 1);
diff -r ecc5fdbf2fe6 -r 850d797d30c8 sql/src/backends/monet5/sql.mx
--- a/sql/src/backends/monet5/sql.mx Thu May 13 10:02:00 2010 +0200
+++ b/sql/src/backends/monet5/sql.mx Thu May 13 19:55:07 2010 +0200
@@ -68,11 +68,6 @@
address SQLstatement
comment "Compile and execute a single sql statement (and optionaly send output
on the output stream)";
-pattern include(fname:str):void
-address SQLinclude
-comment "Load and execute the SQL script identified. A relatief path is
resolved
-from the lib/MonetDB5 installation directory.";
-
pattern assert(b:bit,msg:str):void
address SQLassert
comment "Generate an exception when b==true";
diff -r ecc5fdbf2fe6 -r 850d797d30c8 sql/src/backends/monet5/sql_scenario.mx
--- a/sql/src/backends/monet5/sql_scenario.mx Thu May 13 10:02:00 2010 +0200
+++ b/sql/src/backends/monet5/sql_scenario.mx Thu May 13 19:55:07 2010 +0200
@@ -417,30 +417,28 @@
Based on the initialization retun value we can prepare a SQLinit string with
all information needed
to initialize the catalog based on the mandatory scripts to be executed.
@c
- if ( SQLnewcatalog > 0 && sqlinit == NULL){
- char path[PATHLENGTH];
+ if (SQLnewcatalog > 0 && sqlinit == NULL) {
str fullname;
- snprintf(path,PATHLENGTH,"createdb.sql");
- slash_2_dir_sep(path);
- fullname = MSP_locate_script(path);
+ fullname = MSP_locate_sqlscript("createdb");
if (fullname) {
fd = open_rastream(fullname);
GDKfree(fullname);
- if ( fd) {
+ if (fd) {
bfd = bstream_create(fd, 128 * BLOCK);
- stream_printf(c->fdout,"# SQL catalog created,
load the sql scripts once\n");
- if( bfd == 0 || bstream_next(bfd) < 0) {
- sqlinit= bfd->buf;
+ stream_printf(c->fdout, "# SQL catalog created,
"
+ "initial load of sql
scripts\n");
+ if (bfd == 0 || bstream_next(bfd) < 0) {
+ sqlinit = bfd->buf;
SQLnewcatalog = INT_MAX;
}
}
- }
- if ( SQLnewcatalog != INT_MAX)
- stream_printf(c->fdout,"#WARNING: could not read
createdb.sql\n");
+ }
+ if (SQLnewcatalog != INT_MAX)
+ stream_printf(c->fdout, "#WARNING: could not read
createdb.sql\n");
}
- if (sqlinit) { /* add sqlinit to the fdin stack */
+ if (sqlinit) { /* add sqlinit to the fdin stack */
buffer *b = (buffer*)GDKmalloc(sizeof(buffer));
size_t len = strlen(sqlinit);
bstream *fdin;
@@ -450,7 +448,7 @@
bstream_next(fdin);
MCpushClientInput(c, fdin, 0, "");
}
- if ( SQLnewcatalog == INT_MAX){
+ if (SQLnewcatalog == INT_MAX) {
stream_close(fd);
stream_destroy(fd);
}
@@ -746,32 +744,6 @@
*ret= _strdup("SQLcompile");
return msg;
}
-...@-
-Locate a file with SQL commands to execution.
-...@c
-str
-SQLinclude(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
- stream *fd;
- bstream *bfd;
- str *name = (str *) getArgReference(stk,pci,1);
- str msg = MAL_SUCCEED;
- str *expr;
-
- fd = openSourceFile(*name);
- if (stream_errnr(fd) == OPEN_ERROR) {
- stream_destroy(fd);
- throw(MAL, "sql.include", "could not open file: %s\n", *name);
- }
- bfd = bstream_create(fd, 128 * BLOCK);
- if( bstream_next(bfd) < 0)
- throw(MAL,"sql.include","could not read %s\n", *name);
-
- expr = &bfd->buf;
- msg = SQLstatementIntern(cntxt, expr, "sql.include", TRUE, FALSE);
- (void) mb;
- return msg;
-}
@-
The SQL reader collects a (sequence) of statements from the input
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list