Changeset: 25b588c440e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=25b588c440e5
Added Files:
        sql/test/subquery/Tests/all.sql
        sql/test/subquery/Tests/any.sql
        sql/test/subquery/Tests/any_all.sql
        sql/test/subquery/Tests/scalar.sql
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/mapiclient/mclient.c
        clients/mapilib/mapi.c
        monetdb5/mal/Tests/tst251.stable.out
        monetdb5/modules/atoms/mtime.c
        sql/backends/monet5/Tests/simpleSQL.malC
        sql/backends/monet5/Tests/simpleSQL.stable.out
        sql/backends/monet5/mal_backend.c
        sql/backends/monet5/mal_backend.h
        sql/backends/monet5/sql.mal
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_scenario.h
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
        
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
Branch: cmake-fun
Log Message:

Merge with default.


diffs (truncated from 695 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11724,7 +11724,6 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",       "grow", "pattern sql.grow(tid:bat[:oid], X_0:any_1):int ",      
"mvc_grow_wrap;",       "Resize the tid column of a declared table."    ]
 [ "sql",       "importTable",  "unsafe pattern sql.importTable(sname:str, 
tname:str, onclient:int, fname:str...):bat[:any]... ",       
"mvc_bin_import_table_wrap;",   "Import a table from the files (fname)" ]
 [ "sql",       "include",      "pattern sql.include(fname:str):void ", 
"SQLinclude;",  "Compile and execute a sql statements on the file"      ]
-[ "sql",       "init", "pattern sql.init():void ",     "SQLinitEnvironment;",  
"Initialize the environment for MAL"    ]
 [ "sql",       "lag",  "pattern sql.lag(b:any_1, l:any_2, d:any_1, p:any_3, 
o:any_4):any_1 ",  "SQLlag;",      "return the value in the previous 'l' row in 
the partition or 'd' if non existent"      ]
 [ "sql",       "lag",  "pattern sql.lag(b:any_1, l:any_2, d:bat[:any_1], 
p:any_3, o:any_4):any_1 ",    "SQLlag;",      "return the value in the previous 
'l' row in the partition or 'd' if non existent"      ]
 [ "sql",       "lag",  "pattern sql.lag(b:any_1, l:any_2, p:any_3, 
o:any_4):any_1 ",   "SQLlag;",      "return the value in the previous 'l' row 
in the partition or NULL if non existent"     ]
@@ -11801,8 +11800,6 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",       "single",       "pattern sql.single(x:any_2):bat[:any_2] ",     
"CMDBATsingle;",        ""      ]
 [ "sql",       "sql_environment",      "inline function sql.sql_environment() 
(name:bat[:str], value:bat[:str]);",     "",     ""      ]
 [ "sql",       "sql_variables",        "pattern sql.sql_variables():bat[:str] 
",       "sql_variables;",       "return the table with session variables"      
 ]
-[ "sql",       "start",        "pattern sql.start():void ",    "SQLsession;",  
"Switch to processing SQL statements"   ]
-[ "sql",       "start2",       "pattern sql.start2():void ",   "SQLsession2;", 
"Switch to processing precompiled sql statements"       ]
 [ "sql",       "storage",      "pattern sql.storage() (schema:bat[:str], 
table:bat[:str], column:bat[:str], type:bat[:str], mode:bat[:str], 
location:bat[:str], count:bat[:lng], atomwidth:bat[:int], columnsize:bat[:lng], 
heap:bat[:lng], hashes:bat[:lng], phash:bat[:bit], imprints:bat[:lng], 
sorted:bat[:bit], revsorted:bat[:bit], key:bat[:bit], orderidx:bat[:lng]) ",    
    "sql_storage;", "return a table with storage information "      ]
 [ "sql",       "storage",      "pattern sql.storage(sname:str) 
(schema:bat[:str], table:bat[:str], column:bat[:str], type:bat[:str], 
mode:bat[:str], location:bat[:str], count:bat[:lng], atomwidth:bat[:int], 
columnsize:bat[:lng], heap:bat[:lng], hashes:bat[:lng], phash:bat[:bit], 
imprints:bat[:lng], sorted:bat[:bit], revsorted:bat[:bit], key:bat[:bit], 
orderidx:bat[:lng]) ",       "sql_storage;", "return a table with storage 
information for a particular schema "      ]
 [ "sql",       "storage",      "pattern sql.storage(sname:str, tname:str) 
(schema:bat[:str], table:bat[:str], column:bat[:str], type:bat[:str], 
mode:bat[:str], location:bat[:str], count:bat[:lng], atomwidth:bat[:int], 
columnsize:bat[:lng], heap:bat[:lng], hashes:bat[:lng], phash:bat[:bit], 
imprints:bat[:lng], sorted:bat[:bit], revsorted:bat[:bit], key:bat[:bit], 
orderidx:bat[:lng]) ",    "sql_storage;", "return a table with storage 
information for a particular table"        ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -16138,7 +16138,6 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",       "grow", "pattern sql.grow(tid:bat[:oid], X_0:any_1):int ",      
"mvc_grow_wrap;",       "Resize the tid column of a declared table."    ]
 [ "sql",       "importTable",  "unsafe pattern sql.importTable(sname:str, 
tname:str, onclient:int, fname:str...):bat[:any]... ",       
"mvc_bin_import_table_wrap;",   "Import a table from the files (fname)" ]
 [ "sql",       "include",      "pattern sql.include(fname:str):void ", 
"SQLinclude;",  "Compile and execute a sql statements on the file"      ]
-[ "sql",       "init", "pattern sql.init():void ",     "SQLinitEnvironment;",  
"Initialize the environment for MAL"    ]
 [ "sql",       "lag",  "pattern sql.lag(b:any_1, l:any_2, d:any_1, p:any_3, 
o:any_4):any_1 ",  "SQLlag;",      "return the value in the previous 'l' row in 
the partition or 'd' if non existent"      ]
 [ "sql",       "lag",  "pattern sql.lag(b:any_1, l:any_2, d:bat[:any_1], 
p:any_3, o:any_4):any_1 ",    "SQLlag;",      "return the value in the previous 
'l' row in the partition or 'd' if non existent"      ]
 [ "sql",       "lag",  "pattern sql.lag(b:any_1, l:any_2, p:any_3, 
o:any_4):any_1 ",   "SQLlag;",      "return the value in the previous 'l' row 
in the partition or NULL if non existent"     ]
@@ -16221,8 +16220,6 @@ stdout of test 'MAL-signatures` in direc
 [ "sql",       "single",       "pattern sql.single(x:any_2):bat[:any_2] ",     
"CMDBATsingle;",        ""      ]
 [ "sql",       "sql_environment",      "inline function sql.sql_environment() 
(name:bat[:str], value:bat[:str]);",     "",     ""      ]
 [ "sql",       "sql_variables",        "pattern sql.sql_variables():bat[:str] 
",       "sql_variables;",       "return the table with session variables"      
 ]
-[ "sql",       "start",        "pattern sql.start():void ",    "SQLsession;",  
"Switch to processing SQL statements"   ]
-[ "sql",       "start2",       "pattern sql.start2():void ",   "SQLsession2;", 
"Switch to processing precompiled sql statements"       ]
 [ "sql",       "storage",      "pattern sql.storage() (schema:bat[:str], 
table:bat[:str], column:bat[:str], type:bat[:str], mode:bat[:str], 
location:bat[:str], count:bat[:lng], atomwidth:bat[:int], columnsize:bat[:lng], 
heap:bat[:lng], hashes:bat[:lng], phash:bat[:bit], imprints:bat[:lng], 
sorted:bat[:bit], revsorted:bat[:bit], key:bat[:bit], orderidx:bat[:lng]) ",    
    "sql_storage;", "return a table with storage information "      ]
 [ "sql",       "storage",      "pattern sql.storage(sname:str) 
(schema:bat[:str], table:bat[:str], column:bat[:str], type:bat[:str], 
mode:bat[:str], location:bat[:str], count:bat[:lng], atomwidth:bat[:int], 
columnsize:bat[:lng], heap:bat[:lng], hashes:bat[:lng], phash:bat[:bit], 
imprints:bat[:lng], sorted:bat[:bit], revsorted:bat[:bit], key:bat[:bit], 
orderidx:bat[:lng]) ",       "sql_storage;", "return a table with storage 
information for a particular schema "      ]
 [ "sql",       "storage",      "pattern sql.storage(sname:str, tname:str) 
(schema:bat[:str], table:bat[:str], column:bat[:str], type:bat[:str], 
mode:bat[:str], location:bat[:str], count:bat[:lng], atomwidth:bat[:int], 
columnsize:bat[:lng], heap:bat[:lng], hashes:bat[:lng], phash:bat[:bit], 
imprints:bat[:lng], sorted:bat[:bit], revsorted:bat[:bit], key:bat[:bit], 
orderidx:bat[:lng]) ",    "sql_storage;", "return a table with storage 
information for a particular table"        ]
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <strings.h>           /* strcasecmp */
 #endif
+#include <sys/stat.h>
 #ifdef HAVE_LIBREADLINE
 #include <readline/readline.h>
 #include <readline/history.h>
@@ -3216,6 +3217,18 @@ usage(const char *prog, int xit)
 /* hardwired defaults, only used if monet environment cannot be found */
 #define defaultPort 50000
 
+static inline bool
+isfile(FILE *fp)
+{
+       struct stat stb;
+       if (fstat(fileno(fp), &stb) < 0 ||
+           (stb.st_mode & S_IFMT) != S_IFREG) {
+               fclose(fp);
+               return false;
+       }
+       return true;
+}
+
 int
 main(int argc, char **argv)
 {
@@ -3534,7 +3547,8 @@ main(int argc, char **argv)
        has_fileargs = optind != argc;
 
        if (dbname == NULL && has_fileargs &&
-           (fp = fopen(argv[optind], "r")) == NULL) {
+           ((fp = fopen(argv[optind], "r")) == NULL || !isfile(fp))) {
+               fp = NULL;
                dbname = strdup(argv[optind]);
                optind++;
                has_fileargs = optind != argc;
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3569,7 +3569,7 @@ slice_row(const char *reply, char *null,
        i = 0;
        anchors = length == 0 ? NULL : malloc(length * sizeof(*anchors));
        lens = length == 0 ? NULL : malloc(length * sizeof(*lens));
-       do {
+       for (;;) {
                if (i >= length) {
                        length = i + 1;
                        REALLOC(anchors, length);
@@ -3583,9 +3583,17 @@ slice_row(const char *reply, char *null,
                }
                lens[i] = len;
                anchors[i++] = start;
-               while (reply && *reply && isspace((unsigned char) *reply))
+               if (reply == NULL)
+                       break;
+               while (*reply && isspace((unsigned char) *reply))
+                       reply++;
+               if (*reply == ',') {
                        reply++;
-       } while (reply && *reply && *reply != endchar);
+                       while (*reply && isspace((unsigned char) *reply))
+                               reply++;
+               } else if (*reply == 0 || *reply == endchar)
+                       break;
+       }
        *anchorsp = anchors;
        *lensp = lens;
        return i;
@@ -4694,8 +4702,6 @@ unquote(const char *msg, char **str, con
                /* skip over trailing junk (presumably white space) */
                while (*p && *p != ',' && *p != endchar)
                        p++;
-               if (*p == ',')
-                       p++;
                if (next)
                        *next = p;
                *str = start;
@@ -4717,8 +4723,7 @@ unquote(const char *msg, char **str, con
                        ;
                if (s < msg || !isspace((unsigned char) *s))    /* gone one too 
far */
                        s++;
-               if (*p == ',' || *p == '\t') {
-                       /* there is more to come; skip over separator */
+               if (*p == '\t') {
                        p++;
                }
                len = s - msg;
diff --git a/monetdb5/mal/Tests/tst251.stable.out 
b/monetdb5/mal/Tests/tst251.stable.out
--- a/monetdb5/mal/Tests/tst251.stable.out
+++ b/monetdb5/mal/Tests/tst251.stable.out
@@ -43,7 +43,7 @@ stdout of test 'tst251` in directory 'mo
 [ 0,   "hello" ]
 [ 1,   "brave" ]
 [ 2,   "world" ]
-[ 3    ]
+[ 3,   ""      ]
 [ 4,   nil     ]
 [ 5,   "!"     ]
 
diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -3782,7 +3782,7 @@ MTIMEtimestamp_to_str(str *s, const time
        (void)mktime(&t); /* corrects the tm_wday etc */
        (void)msec;
        if ((sz = strftime(buf, sizeof(buf), *format, &t)) == 0)
-               throw(MAL, "mtime.timestamp_to_str", "failed to convert 
timestampt to string using format '%s'\n", *format);
+               throw(MAL, "mtime.timestamp_to_str", "failed to convert 
timestamp to string using format '%s'\n", *format);
        *s = GDKmalloc(sz + 1);
        if (*s == NULL)
                throw(MAL, "mtime.timestamp_to_str", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
diff --git a/sql/backends/monet5/Tests/simpleSQL.malC 
b/sql/backends/monet5/Tests/simpleSQL.malC
--- a/sql/backends/monet5/Tests/simpleSQL.malC
+++ b/sql/backends/monet5/Tests/simpleSQL.malC
@@ -1,6 +1,5 @@
 #execute simple SQL queries from MAL 
 function foo();
-sql.init();
 sql.eval("select 1;",true);
 
 sql.eval("create table simpleT(i integer);");
diff --git a/sql/backends/monet5/Tests/simpleSQL.stable.out 
b/sql/backends/monet5/Tests/simpleSQL.stable.out
--- a/sql/backends/monet5/Tests/simpleSQL.stable.out
+++ b/sql/backends/monet5/Tests/simpleSQL.stable.out
@@ -25,7 +25,6 @@ stdout of test 'simpleSQL` in directory 
 # 13:03:24 >  
 
 function user.foo():void;
-    sql.init();
     sql.eval("select 1;", true);
     sql.eval("create table simpleT(i integer);");
     sql.eval("insert into simpleT values(123);");
diff --git a/sql/backends/monet5/mal_backend.c 
b/sql/backends/monet5/mal_backend.c
--- a/sql/backends/monet5/mal_backend.c
+++ b/sql/backends/monet5/mal_backend.c
@@ -34,7 +34,6 @@ backend_create(mvc *m, Client c)
 
        if( b== NULL)
                return NULL;
-       b->console = isAdministrator(c);
        b->mvc = m;
        b->client = c;
        b->mvc_var = 0;
diff --git a/sql/backends/monet5/mal_backend.h 
b/sql/backends/monet5/mal_backend.h
--- a/sql/backends/monet5/mal_backend.h
+++ b/sql/backends/monet5/mal_backend.h
@@ -36,7 +36,6 @@ typedef enum output_format {
  * generated or not */
 
 typedef struct backend {
-       bool    console;
        char    language;               /* 'S' or 's' or 'X' */
        char    depth;
        bool    first_statement_generated;
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -7,18 +7,6 @@
 module batsql;
 module sql;
 
-pattern start():void 
-address SQLsession
-comment "Switch to processing SQL statements";
-
-pattern start2():void
-address SQLsession2
-comment "Switch to processing precompiled sql statements";
-
-pattern init():void
-address SQLinitEnvironment
-comment "Initialize the environment for MAL";
-
 pattern shutdown(delay:bte, force:bit):str
 address SQLshutdown_wrap;
 pattern shutdown(delay:sht, force:bit):str
@@ -51,7 +39,6 @@ pattern abort()
 address SQLabort
 comment "Trigger the abort operation for a MAL block";
 
-
 pattern eval(cmd:str):void 
 address SQLstatement
 comment "Compile and execute a single sql statement";
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
@@ -85,52 +85,6 @@ monet5_freecode(int clientid, backend_co
 #endif
 }
 
-str
-SQLsession(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       str msg = MAL_SUCCEED;
-       const char *logmsg;
-       int cnt=0;
-
-       (void) mb;
-       (void) stk;
-       (void) pci;
-       if (SQLinitialized == 0)// && (msg = SQLprelude(NULL)) != MAL_SUCCEED)
-               return msg;
-       msg = setScenario(cntxt, "sql");
-       // Wait for any recovery process to be finished
-       do {
-               MT_sleep_ms(1000);
-               logmsg = GDKgetenv("recovery");
-               if( logmsg== NULL && ++cnt  == 5)
-                       throw(SQL,"SQLinit", "#WARNING server not ready, 
recovery in progress\n");
-       } while (logmsg == NULL);
-       return msg;
-}
-
-str
-SQLsession2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       str msg = MAL_SUCCEED;
-       const char *logmsg;
-       int cnt=0;
-
-       (void) mb;
-       (void) stk;
-       (void) pci;
-       if (SQLinitialized == 0)// && (msg = SQLprelude(NULL)) != MAL_SUCCEED)
-               return msg;
-       msg = setScenario(cntxt, "msql");
-       // Wait for any recovery process to be finished
-       do {
-               MT_sleep_ms(1000);
-               logmsg = GDKgetenv("recovery");
-               if( logmsg== NULL && ++cnt  == 5)
-                       throw(SQL,"SQLinit","#WARNING server not ready, 
recovery in progress\n");
-       } while (logmsg == NULL);
-       return msg;
-}
-
 static str SQLinit(Client c);
 
 str
@@ -140,7 +94,6 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
        str tmp;
        Scenario ms, s = getFreeScenario();
 
-//     (void) ret;
        (void) mb;
        (void) stk;
        (void) pci;
@@ -307,7 +260,7 @@ SQLprepareClient(Client c, int login)
                        mvc_destroy(m);
                        throw(SQL,"sql.initClient",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
                }
-               if (isAdministrator(c) || strcmp(c->scenario, "msql") == 0)     
/* console should return everything */
+               if (strcmp(c->scenario, "msql") == 0)
                        m->reply_size = -1;
                be = (void *) backend_create(m, c);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to