Changeset: 2eb0db5e1026 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2eb0db5e1026
Added Files:
        clients/Tests/mclient-uri.SQL.bat
        clients/Tests/mclient-uri.SQL.sh
        clients/Tests/mclient-uri.stable.err
        clients/Tests/mclient-uri.stable.out
        clients/Tests/mclient-uri.stable.out.Windows
        sql/test/Tests/copy-into-fwf.sql.in
        sql/test/Tests/copy-into-fwf.stable.err
        sql/test/Tests/copy-into-fwf.stable.out
        sql/test/Tests/mtcars
Modified Files:
        clients/Tests/All
        clients/mapilib/mapi.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_statement.c
        sql/test/Tests/All
Branch: Jul2017
Log Message:

Merge with Dec2016 branch.


diffs (truncated from 419 to 300 lines):

diff --git a/clients/Tests/All b/clients/Tests/All
--- a/clients/Tests/All
+++ b/clients/Tests/All
@@ -1,3 +1,4 @@
 exports
 
HAVE_FITS&HAVE_GEOM&HAVE_LIBPY&HAVE_LIBR&HAVE_LIDAR&HAVE_NETCDF&HAVE_SAMTOOLS&HAVE_SHP?MAL-signatures
 MERCURIAL?malcheck
+mclient-uri
diff --git a/clients/Tests/mclient-uri.SQL.bat 
b/clients/Tests/mclient-uri.SQL.bat
new file mode 100755
--- /dev/null
+++ b/clients/Tests/mclient-uri.SQL.bat
@@ -0,0 +1,6 @@
+@prompt # $t $g  
+@echo on
+
+@rem Windows doesn't do UNIX domain sockets, so only the one test here.
+
+mclient -d 
"mapi:monetdb://%HOST%:%MAPIPORT%/%TSTDB%?language=sql&user=monetdb" -f test -E 
utf-8 -s "select 1"
diff --git a/clients/Tests/mclient-uri.SQL.sh b/clients/Tests/mclient-uri.SQL.sh
new file mode 100755
--- /dev/null
+++ b/clients/Tests/mclient-uri.SQL.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# test the URI parsing capabilities of the MAPI library
+
+Mlog "mclient -d 
mapi:monetdb://$HOST:$MAPIPORT/$TSTDB?language=sql&user=monetdb -f test -E 
utf-8 -s select 1"
+mclient -d "mapi:monetdb://$HOST:$MAPIPORT/$TSTDB?language=sql&user=monetdb" 
-f test -E utf-8 -s 'select 1'
+
+Mlog "mclient -d 
mapi:monetdb://$MAPIHOST/.s.monetdb.$MAPIPORT?database=$TSTDB&language=sql&user=monetdb
 -f test -E utf-8 -s select 1"
+mclient -d 
"mapi:monetdb://$MAPIHOST/.s.monetdb.$MAPIPORT?database=$TSTDB&language=sql&user=monetdb"
 -f test -E utf-8 -s 'select 1'
diff --git a/clients/Tests/mclient-uri.stable.err 
b/clients/Tests/mclient-uri.stable.err
new file mode 100644
--- /dev/null
+++ b/clients/Tests/mclient-uri.stable.err
@@ -0,0 +1,44 @@
+stderr of test 'mclient-uri` in directory 'clients` itself:
+
+
+# 10:30:50 >  
+# 10:30:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=36840" "--set" 
"mapi_usock=/var/tmp/mtest-2769/.s.monetdb.36840" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_clients"
+# 10:30:50 >  
+
+# builtin opt  gdk_dbpath = /ufs/sjoerd/@Monet-stable/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 36840
+# cmdline opt  mapi_usock = /var/tmp/mtest-2769/.s.monetdb.36840
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_clients
+# cmdline opt  gdk_debug = 536870922
+
+# 10:30:51 >  
+# 10:30:51 >  "./mclient-uri.SQL.sh" "mclient-uri"
+# 10:30:51 >  
+
+
+# 10:30:51 >  
+# 10:30:51 >  mclient -d 
mapi:monetdb://madrid:36840/mTests_clients?language=sql&user=monetdb -f test -E 
utf-8 -s select 1
+# 10:30:51 >  
+
+
+# 10:30:51 >  
+# 10:30:51 >  mclient -d 
mapi:monetdb:///var/tmp/mtest-2769/.s.monetdb.36840?database=mTests_clients&language=sql&user=monetdb
 -f test -E utf-8 -s select 1
+# 10:30:51 >  
+
+
+# 10:30:51 >  
+# 10:30:51 >  "Done."
+# 10:30:51 >  
+
diff --git a/clients/Tests/mclient-uri.stable.out 
b/clients/Tests/mclient-uri.stable.out
new file mode 100644
--- /dev/null
+++ b/clients/Tests/mclient-uri.stable.out
@@ -0,0 +1,51 @@
+stdout of test 'mclient-uri` in directory 'clients` itself:
+
+
+# 10:30:50 >  
+# 10:30:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=36840" "--set" 
"mapi_usock=/var/tmp/mtest-2769/.s.monetdb.36840" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_clients"
+# 10:30:50 >  
+
+# MonetDB 5 server v11.25.22 (hg id: 7b4a32dfbcc5+)
+# This is an unreleased version
+# Serving database 'mTests_clients', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.589 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:36840/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-2769/.s.monetdb.36840
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 10:30:51 >  
+# 10:30:51 >  "./mclient-uri.SQL.sh" "mclient-uri"
+# 10:30:51 >  
+
+
+# 10:30:51 >  
+# 10:30:51 >  mclient -d 
mapi:monetdb://madrid:36840/mTests_clients?language=sql&user=monetdb -f test -E 
utf-8 -s select 1
+# 10:30:51 >  
+
+% .L2 # table_name
+% L2 # name
+% tinyint # type
+% 1 # length
+[ 1    ]
+
+# 10:30:51 >  
+# 10:30:51 >  mclient -d 
mapi:monetdb:///var/tmp/mtest-2769/.s.monetdb.36840?database=mTests_clients&language=sql&user=monetdb
 -f test -E utf-8 -s select 1
+# 10:30:51 >  
+
+% .L2 # table_name
+% L2 # name
+% tinyint # type
+% 1 # length
+[ 1    ]
+
+# 10:30:51 >  
+# 10:30:51 >  "Done."
+# 10:30:51 >  
+
diff --git a/clients/Tests/mclient-uri.stable.out.Windows 
b/clients/Tests/mclient-uri.stable.out.Windows
new file mode 100644
--- /dev/null
+++ b/clients/Tests/mclient-uri.stable.out.Windows
@@ -0,0 +1,33 @@
+stdout of test 'mclient-uri` in directory 'clients` itself:
+
+
+# 10:30:50 >  
+# 10:30:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=36840" "--set" 
"mapi_usock=/var/tmp/mtest-2769/.s.monetdb.36840" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_clients"
+# 10:30:50 >  
+
+# MonetDB 5 server v11.25.22 (hg id: 7b4a32dfbcc5+)
+# This is an unreleased version
+# Serving database 'mTests_clients', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.589 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:36840/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-2769/.s.monetdb.36840
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+
+% .L2 # table_name
+% L2 # name
+% tinyint # type
+% 1 # length
+[ 1    ]
+
+# 10:30:51 >  
+# 10:30:51 >  "Done."
+# 10:30:51 >  
+
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1945,6 +1945,7 @@ mapi_mapiuri(const char *url, const char
        char *host;
        int port;
        char *dbname;
+       char *query;
 
        if (!mapi_initialized) {
                mapi_initialized = 1;
@@ -2007,6 +2008,7 @@ mapi_mapiuri(const char *url, const char
                host = uri;
                port = 0;
                dbname = NULL;
+               query = uri;
        } else {
                char *p;
 
@@ -2034,11 +2036,12 @@ mapi_mapiuri(const char *url, const char
                                      "mapi_mapiuri", MERROR);
                        return mid;
                }
+               query = dbname;
        }
        mid->port = port;
 
        /* this is in particular important for unix sockets */
-       parse_uri_query(mid, uri);
+       parse_uri_query(mid, query);
 
        /* doing this here, because parse_uri_query will
         * terminate the string if a ? is in place */
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -216,7 +216,7 @@ stmt_group(backend *be, stmt *s, stmt *g
 
        q = newStmt(mb, groupRef, done ? grp ? subgroupdoneRef : groupdoneRef : 
grp ? subgroupRef : groupRef);
 
-       /* output variables extend and hist */
+       /* output variables extent and hist */
        q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
        q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
        q = pushArgument(mb, q, s->nr);
diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -108,3 +108,5 @@ HAVE_JDBCCLIENT_JAR?bogus-auto-generated
 str-pad
 str-trim
 alastair_udf_mergetable_bug
+
+copy-into-fwf
diff --git a/sql/test/Tests/copy-into-fwf.sql.in 
b/sql/test/Tests/copy-into-fwf.sql.in
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/copy-into-fwf.sql.in
@@ -0,0 +1,19 @@
+create table mtcars (
+    mpg DOUBLE PRECISION,
+    cyl DOUBLE PRECISION,
+    disp DOUBLE PRECISION,
+    hp DOUBLE PRECISION,
+    drat DOUBLE PRECISION,
+    wt DOUBLE PRECISION,
+    qsec DOUBLE PRECISION,
+    vs DOUBLE PRECISION,
+    am DOUBLE PRECISION,
+    gear DOUBLE PRECISION,
+    carb DOUBLE PRECISION
+);
+
+copy into mtcars from '$TSTSRCDIR/mtcars' using delimiters 'a','b','c' null as 
'' fwf (4, 2, 6, 4, 5, 6, 6, 2, 2, 2, 2);
+
+select * from mtcars;
+
+drop table mtcars;
diff --git a/sql/test/Tests/copy-into-fwf.stable.err 
b/sql/test/Tests/copy-into-fwf.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/copy-into-fwf.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'copy-into-fwf` in directory 'sql/test` itself:
+
+
+# 11:22:36 >  
+# 11:22:36 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=35843" "--set" 
"mapi_usock=/var/tmp/mtest-10839/.s.monetdb.35843" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_sql_test"
+# 11:22:36 >  
+
+# builtin opt  gdk_dbpath = /ufs/sjoerd/@Monet-stable/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 35843
+# cmdline opt  mapi_usock = /var/tmp/mtest-10839/.s.monetdb.35843
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_sql_test
+# cmdline opt  gdk_debug = 536870922
+
+# 11:22:37 >  
+# 11:22:37 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-10839" "--port=35843"
+# 11:22:37 >  
+
+
+# 11:22:37 >  
+# 11:22:37 >  "Done."
+# 11:22:37 >  
+
diff --git a/sql/test/Tests/copy-into-fwf.stable.out 
b/sql/test/Tests/copy-into-fwf.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/copy-into-fwf.stable.out
@@ -0,0 +1,84 @@
+stdout of test 'copy-into-fwf` in directory 'sql/test` itself:
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to