Changeset: 4abd5817a73f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4abd5817a73f Added Files: sql/jdbc/tests/Tests/JdbcClient_create_tables.sql sql/jdbc/tests/Tests/JdbcClient_drop_tables.sql sql/jdbc/tests/Tests/JdbcClient_inserts_selects.sql Removed Files: sql/jdbc/tests/JdbcClient_create_tables.sql sql/jdbc/tests/JdbcClient_inserts_selects.sql Modified Files: sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat sql/jdbc/tests/Tests/Test_JdbcClient.SQL.sh sql/jdbc/tests/Tests/Test_JdbcClient.stable.out Branch: Apr2019 Log Message:
Extend JdbcClient test with - showing help text - dropping created tables, indexes and views - added also creation of a GLOBAL TEMP TABLE Also moved the 2 JdbcClient_*.sql files to the Tests directory. diffs (truncated from 309 to 300 lines): diff --git a/sql/jdbc/tests/JdbcClient_create_tables.sql b/sql/jdbc/tests/Tests/JdbcClient_create_tables.sql rename from sql/jdbc/tests/JdbcClient_create_tables.sql rename to sql/jdbc/tests/Tests/JdbcClient_create_tables.sql --- a/sql/jdbc/tests/JdbcClient_create_tables.sql +++ b/sql/jdbc/tests/Tests/JdbcClient_create_tables.sql @@ -46,7 +46,7 @@ CREATE INDEX "triples_subject_predicate_ CREATE View subject_stats as SELECT "subject", CAST(COUNT(*) AS BIGINT) AS counts, MIN("subject") AS min_value, MAX("subject") AS max_value FROM "triples" GROUP BY "subject" ORDER BY "subject"; CREATE View predicate_stats as SELECT "predicate", CAST(COUNT(*) AS BIGINT) AS counts, MIN("predicate") AS min_value, MAX("predicate") AS max_value FROM "triples" GROUP BY "predicate" ORDER BY "predicate"; -CREATE View object_stats as SELECT "object", CAST(COUNT(*) AS BIGINT) AS counts, MIN("object") AS min_value, MAX("object") AS max_value FROM "triples" GROUP BY "object" ORDER BY "object"; +CREATE OR REPLACE View object_stats as SELECT "object", CAST(COUNT(*) AS BIGINT) AS counts, MIN("object") AS min_value, MAX("object") AS max_value FROM "triples" GROUP BY "object" ORDER BY "object"; CREATE MERGE TABLE mt (id int primary key, nm varchar(123) NOT NULL); @@ -54,4 +54,6 @@ CREATE REMOTE TABLE remt (id int prima CREATE REPLICA TABLE replt (id int primary key, nm varchar(123) NOT NULL); CREATE STREAM TABLE strt (id int primary key, nm varchar(123) NOT NULL); +CREATE GLOBAL TEMP TABLE gtmpt (id int primary key, nm varchar(123) NOT NULL) ON COMMIT PRESERVE ROWS; + COMMIT; diff --git a/sql/jdbc/tests/Tests/JdbcClient_drop_tables.sql b/sql/jdbc/tests/Tests/JdbcClient_drop_tables.sql new file mode 100644 --- /dev/null +++ b/sql/jdbc/tests/Tests/JdbcClient_drop_tables.sql @@ -0,0 +1,28 @@ +DROP View subject_stats; +DROP View predicate_stats; +DROP View object_stats; + +DROP INDEX allnewtriples_subject_idx; +DROP INDEX allnewtriples_predicate_idx; +DROP INDEX allnewtriples_object_idx; + +DROP TABLE allnewtriples CASCADE; + +DROP TABLE "foreign" CASCADE; + +DROP INDEX "triples_object_idx"; +DROP INDEX "triples_predicate_idx"; +DROP INDEX "triples_predicate_object_idx"; +DROP INDEX "triples_subject_idx"; +DROP INDEX "triples_subject_object_idx"; +DROP INDEX "triples_subject_predicate_idx"; + +DROP TABLE "triples" CASCADE; + +DROP TABLE mt; +DROP TABLE remt; +DROP TABLE replt; +DROP TABLE strt; + +DROP TABLE gtmpt; + diff --git a/sql/jdbc/tests/JdbcClient_inserts_selects.sql b/sql/jdbc/tests/Tests/JdbcClient_inserts_selects.sql rename from sql/jdbc/tests/JdbcClient_inserts_selects.sql rename to sql/jdbc/tests/Tests/JdbcClient_inserts_selects.sql diff --git a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat --- a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat +++ b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat @@ -6,10 +6,11 @@ echo password=monetdb>> .monetdb prompt # $t $g echo on -java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" -f "%TSTSRCBASE%\%TSTDIR%\JdbcClient_create_tables.sql" +java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" --help -java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" -f "%TSTSRCBASE%\%TSTDIR%\JdbcClient_inserts_selects.sql" - +java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" -f "%TSTSRCBASE%\%TSTDIR%\Tests\JdbcClient_create_tables.sql" +java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" -f "%TSTSRCBASE%\%TSTDIR%\Tests\JdbcClient_inserts_selects.sql" java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" -D +java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%" -f "%TSTSRCBASE%\%TSTDIR%\Tests\JdbcClient_drop_tables.sql" @del .monetdb diff --git a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.sh b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.sh --- a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.sh +++ b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.sh @@ -5,10 +5,11 @@ user=monetdb password=monetdb EOF -Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB -f $TSTSRCBASE/$TSTDIR/JdbcClient_create_tables.sql" +Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB --help" -Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB -f $TSTSRCBASE/$TSTDIR/JdbcClient_inserts_selects.sql" - +Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB -f $TSTSRCBASE/$TSTDIR/Tests/JdbcClient_create_tables.sql" +Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB -f $TSTSRCBASE/$TSTDIR/Tests/JdbcClient_inserts_selects.sql" Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB -D" +Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d $TSTDB -f $TSTSRCBASE/$TSTDIR/Tests/JdbcClient_drop_tables.sql" rm -f .monetdb diff --git a/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out b/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out --- a/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out +++ b/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out @@ -1,27 +1,87 @@ stdout of test 'Test_JdbcClient` in directory 'sql/jdbc/tests` itself: -# 20:01:23 > -# 20:01:23 > Mtimeout -timeout 180 Mserver "--config=/ufs/fabian/scratch/monetdb/current/program-x86_64/etc/MonetDB.conf" --debug=10 --set "monet_mod_path=/ufs/fabian/scratch/monetdb/current/program-x86_64/lib/MonetDB:/ufs/fabian/scratch/monetdb/current/program-x86_64/lib/bin" --set "gdk_dbfarm=/ufs/fabian/scratch/monetdb/current/program-x86_64/var/MonetDB/dbfarm" --set "sql_logdir=/ufs/fabian/scratch/monetdb/current/program-x86_64/var/MonetDB/log" --set mapi_port=34230 --set sql_port=47764 --set xquery_port=59693 --set monet_prompt= --trace "--dbname=mTests_src_jdbc_tests" --dbinit="module(sql_server); sql_server_start();" ; echo ; echo Over.. -# 20:01:23 > +# 18:15:39 > +# 18:15:39 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=31817" "--set" "mapi_usock=/var/tmp/mtest-15181/.s.monetdb.31817" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" "--set" "embedded_c=true" +# 18:15:39 > -# Monet Database Server V4.9.3 -# Copyright (c) 1993-2005, CWI. All rights reserved. -# Compiled for x86_64-redhat-linux-gnu/64bit with 64bit OIDs; dynamically linked. -# Visit http://monetdb.cwi.nl/ for further information. - +# MonetDB 5 server v11.33.12 (hg id: d8c48170bbe6+) +# This is an unreleased version +# Serving database 'mTests_sql_jdbc_tests', using 4 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers +# Found 31.305 GiB available main-memory. +# Copyright (c) 1993 - July 2008 CWI. +# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://catskill.da.cwi.nl:31817/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-15181/.s.monetdb.31817 +# MonetDB/GIS module loaded +# SQL catalog created, loading sql scripts once +# MonetDB/SQL module loaded Ready. - -# 20:01:23 > -# 20:01:23 > Mtimeout -timeout 60 ./Test_JdbcClient.SQL Test_JdbcClient -# 20:01:23 > +# 18:15:40 > +# 18:15:40 > "./Test_JdbcClient.SQL.sh" "Test_JdbcClient" +# 18:15:40 > -# 12:08:05 > -# 12:08:05 > java -jar /net/pegasus.ins.cwi.nl/export/scratch1/fabian/monetdb/current/build-pegasus.ins.cwi.nl/sql/src/jdbc/jdbcclient-1.2.jar -h localhost -p 42784 -f ../../../../..//current/sql/src/jdbc/tests/Tests/../JdbcClient_create_tables.sql -# 12:08:05 > +# 18:15:40 > +# 18:15:40 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 31817 -d mTests_sql_jdbc_tests --help +# 18:15:40 > + +Usage java -jar jdbcclient.jar + [-h host[:port]] [-p port] [-f file] [-u user] + [-l language] [-d database] [-e] [-D [table]] + [-X<opt>] +or using long option equivalents --host --port --file --user --language +--dump --echo --database. +Arguments may be written directly after the option like -p50000. + +If no host and port are given, localhost and 50000 are assumed. +An .monetdb file may exist in the user's home directory. This file can contain +preferences to use each time JdbcClient is started. Options given on the +command line override the preferences file. The .monetdb file syntax is +<option>=<value> where option is one of the options host, port, file, mode +debug, or password. Note that the last one is perilous and therefore not +available as command line option. +If no input file is given using the -f flag, an interactive session is +started on the terminal. + +OPTIONS +-h --host The hostname of the host that runs the MonetDB database. A port + number can be supplied by use of a colon, i.e. -h somehost:12345. +-p --port The port number to connect to. +-f --file A file name to use either for reading or writing. The file will + be used for writing when dump mode is used (-D --dump). In read + mode, the file can also be an URL pointing to a plain text file + that is optionally gzip compressed. +-u --user The username to use when connecting to the database. +-d --database Try to connect to the given database (only makes sense if + connecting to monetdbd). +-l --language Use the given language, defaults to 'sql'. +--help This help screen. +--version Display driver version and exit. +-e --echo Also outputs the contents of the input file, if any. +-q --quiet Suppress printing the welcome header. +-D --dump Dumps the given table(s), or the complete database if none given. +-Xoutput The output mode when dumping. Default is sql, xml may be used for + an experimental XML output. +-Xhash Use the given hash algorithm during challenge response. Supported + algorithm names: SHA1, MD5, plain. +-Xdebug Writes a transmission log to disk for debugging purposes. If a + file name is given, it is used, otherwise a file called + monet<timestamp>.log is created. A given file never be + overwritten; instead a unique variation of the file is used. +-Xbatching Indicates that a batch should be used instead of direct + communication with the server for each statement. If a number is + given, it is used as batch size. i.e. 8000 would execute the + contents on the batch after each 8000 statements read. Batching + can greatly speedup the process of restoring a database dump. + +# 18:15:40 > +# 18:15:40 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 31817 -d mTests_sql_jdbc_tests -f /export/scratch1/dinther/dev/sql/jdbc/tests/Tests/JdbcClient_create_tables.sql +# 18:15:40 > Operation successful Operation successful @@ -44,14 +104,13 @@ Operation successful Operation successful Operation successful Operation successful - +Operation successful -# 12:08:05 > -# 12:08:05 > java -jar /net/pegasus.ins.cwi.nl/export/scratch1/fabian/monetdb/current/build-pegasus.ins.cwi.nl/sql/src/jdbc/jdbcclient-1.2.jar -h localhost -p 42784 -f ../../../../..//current/sql/src/jdbc/tests/Tests/../JdbcClient_inserts_selects.sql -# 12:08:05 > +# 18:15:40 > +# 18:15:40 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 31817 -d mTests_sql_jdbc_tests -f /export/scratch1/dinther/dev/sql/jdbc/tests/Tests/JdbcClient_inserts_selects.sql +# 18:15:40 > Operation successful - 1 affected row 1 affected row 1 affected row @@ -66,7 +125,6 @@ 1 affected row 1 affected row 1 affected row 1 affected row - +------+---------+-----------+--------+----------+ | id | subject | predicate | object | explicit | +======+=========+===========+========+==========+ @@ -127,9 +185,9 @@ 2 rows 2 rows Operation successful -# 17:26:44 > -# 17:26:44 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 33431 -d mTests_sql_jdbc_tests -D -# 17:26:44 > +# 18:15:40 > +# 18:15:40 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 31817 -d mTests_sql_jdbc_tests -D +# 18:15:40 > START TRANSACTION; @@ -145,7 +203,7 @@ CREATE REMOTE TABLE "sys"."remt" ( "id" INTEGER NOT NULL, "nm" VARCHAR(123) NOT NULL, CONSTRAINT "remt_id_pkey" PRIMARY KEY ("id") -); +) ON 'mapi:monetdb://localhost:42001/mdb3'; CREATE REPLICA TABLE "sys"."replt" ( "id" INTEGER NOT NULL, @@ -166,8 +224,8 @@ CREATE TABLE "sys"."allnewtriples" ( "predicate" INTEGER NOT NULL, "object" INTEGER NOT NULL, "explicit" BOOLEAN NOT NULL, - CONSTRAINT "allnewtriples_id_pkey" PRIMARY KEY ("id"), - CONSTRAINT "unique_key" UNIQUE ("subject", "predicate", "object") + CONSTRAINT "allnewtriples_id_pkey" PRIMARY KEY ("id"), + CONSTRAINT "unique_key" UNIQUE ("subject", "predicate", "object") ); CREATE INDEX "allnewtriples_object_idx" ON "sys"."allnewtriples" ("object"); CREATE INDEX "allnewtriples_predicate_idx" ON "sys"."allnewtriples" ("predicate"); @@ -221,18 +279,43 @@ INSERT INTO "sys"."triples" VALUES (5, 1 INSERT INTO "sys"."triples" VALUES (6, 2, 2, 1, false); INSERT INTO "sys"."triples" VALUES (7, 2, 2, 2, false); -CREATE VIEW "sys"."object_stats" AS select "object", cast(count(*) as bigint) as counts, min("object") as min_value, max("object") as max_value from "triples" group by "object" order by "object" +create or replace view object_stats as select "object", cast(count(*) as bigint) as counts, min("object") as min_value, max("object") as max_value from "triples" group by "object" order by "object" ; -CREATE VIEW "sys"."predicate_stats" AS select "predicate", cast(count(*) as bigint) as counts, min("predicate") as min_value, max("predicate") as max_value from "triples" group by "predicate" order by "predicate" +create view predicate_stats as select "predicate", cast(count(*) as bigint) as counts, min("predicate") as min_value, max("predicate") as max_value from "triples" group by "predicate" order by "predicate" ; -CREATE VIEW "sys"."subject_stats" AS select "subject", cast(count(*) as bigint) as counts, min("subject") as min_value, max("subject") as max_value from "triples" group by "subject" order by "subject" +create view subject_stats as select "subject", cast(count(*) as bigint) as counts, min("subject") as min_value, max("subject") as max_value from "triples" group by "subject" order by "subject" ; COMMIT; -# 20:01:25 > -# 20:01:25 > Done. -# 20:01:25 > +# 18:15:41 > +# 18:15:41 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 31817 -d mTests_sql_jdbc_tests -f /export/scratch1/dinther/dev/sql/jdbc/tests/Tests/JdbcClient_drop_tables.sql +# 18:15:41 > +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful +Operation successful _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list