Changeset: e81d4a38ef86 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e81d4a38ef86
Added Files:
        clients/R/MonetDB.R/R/mclient.R
        clients/R/MonetDB.R/man/mclient.Rd
        sql/test/BugTracker-2015/Tests/long_insert.Bug-3845.sql
Removed Files:
        clients/nodejs/Tests/nodetest.js
        clients/nodejs/monetdb/README.md
        clients/nodejs/monetdb/mapiclient.js
        clients/nodejs/monetdb/package.json
Modified Files:
        .hgtags
        MonetDB.spec
        NT/installer32/MonetDB-ODBC-Installer.vdproj
        NT/installer32/MonetDB5-Geom-Module.vdproj
        NT/installer32/MonetDB5-SQL-Installer.vdproj
        NT/installer64/MonetDB-ODBC-Installer.vdproj
        NT/installer64/MonetDB5-Geom-Module.vdproj
        NT/installer64/MonetDB5-SQL-Installer.vdproj
        NT/monetdb_config.h.in
        NT/rules.msc
        clients/Makefile.ag
        clients/R/MonetDB.R/DESCRIPTION
        clients/R/MonetDB.R/NAMESPACE
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/dbi.R
        clients/R/Tests/dbi.stable.out
        clients/R/build-for-cran.sh
        clients/Tests/SQL-dump.stable.out
        clients/Tests/exports.stable.out
        clients/mapiclient/mclient.c
        clients/mapilib/mapi.rc
        clients/odbc/driver/driver.rc
        clients/odbc/winsetup/setup.rc
        clients/python2/setup.py
        clients/python3/setup.py
        clients/ruby/Makefile.ag
        clients/ruby/Tests/All
        clients/ruby/Tests/rubytest.rb
        clients/ruby/Tests/rubytest.stable.out
        configure.ag
        debian/changelog
        gdk/gdk_atoms.c
        gdk/libbat.rc
        libversions
        monetdb5/mal/mal.h
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_instruction.h
        monetdb5/modules/mal/manifold.c
        monetdb5/optimizer/opt_constants.c
        monetdb5/optimizer/opt_costModel.c
        monetdb5/optimizer/opt_mitosis.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/tools/libmonetdb5.rc
        sql/backends/monet5/sql_optimizer.c
        sql/test/BugTracker-2015/Tests/All
        sql/test/copy/Tests/key_copy.stable.err
        sql/test/mergetables/Tests/mergequery.stable.out
        sql/test/remote/Tests/partition_elim.stable.out
        testing/Mfilter.py
        tools/embedded/embedded.c
        tools/embedded/embedded.h
        tools/embedded/embeddedr.c
        tools/embedded/rpackage/configure
        tools/embedded/rpackage/configure.win
        vertoo.data
Branch: embedded-java
Log Message:

Merge with embedded branch


diffs (truncated from 2828 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -610,3 +610,6 @@ d1bce2fabbc36a3a3b996b09e55e764a626026a8
 d1dd6e5b7a5acfe14a33070e08c776341996deb2 Jul2015_9
 d1bce2fabbc36a3a3b996b09e55e764a626026a8 Jul2015_SP1_release
 d1dd6e5b7a5acfe14a33070e08c776341996deb2 Jul2015_SP1_release
+2ca94cddcdf52121541eff4bf706b1b7c451f511 Jul2015_11
+d1dd6e5b7a5acfe14a33070e08c776341996deb2 Jul2015_SP1_release
+2ca94cddcdf52121541eff4bf706b1b7c451f511 Jul2015_SP1_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -995,6 +995,12 @@ rm -f %{buildroot}%{_bindir}/Maddlog
 %postun -p /sbin/ldconfig
 
 %changelog
+* Fri Oct 30 2015 Sjoerd Mullender <sjo...@acm.org> - 11.21.11-20151030
+- Rebuilt.
+- BZ#3828: Schema corruption after several ALTER TABLE statements and
+  server restart
+- BZ#3839: msqldump generates incorrect syntax ON UPDATE (null)
+
 * Mon Oct 26 2015 Sjoerd Mullender <sjo...@acm.org> - 11.21.9-20151026
 - Rebuilt.
 - BZ#3816: Server crashes when trying to convert timestamp to str with
diff --git a/clients/Makefile.ag b/clients/Makefile.ag
--- a/clients/Makefile.ag
+++ b/clients/Makefile.ag
@@ -6,4 +6,4 @@
 
 SUBDIRS = mapilib mapiclient HAVE_ODBC?odbc HAVE_PERL?perl php 
HAVE_RUBYGEM?ruby examples HAVE_PYTHON2?python2 HAVE_PYTHON3?python3 
NATIVE_WIN32?NT
 
-EXTRA_DIST_DIR = Tests R nodejs
+EXTRA_DIST_DIR = Tests R
diff --git a/clients/R/MonetDB.R/DESCRIPTION b/clients/R/MonetDB.R/DESCRIPTION
--- a/clients/R/MonetDB.R/DESCRIPTION
+++ b/clients/R/MonetDB.R/DESCRIPTION
@@ -8,9 +8,10 @@ Author: Hannes Muehleisen [aut, cre], Th
 Maintainer: Hannes Muehleisen <han...@cwi.nl>
 Depends: DBI (>= 0.3.1)
 Imports: digest (>= 0.6.4), methods, codetools
-Enhances: dplyr (>= 0.3.0)
+Enhances: dplyr (>= 0.3.0), MonetDBLite
 Description: Allows to pull data from MonetDB into R. Includes a DBI 
implementation and a dplyr backend.
 License: MPL (== 1.1)
 URL: http://monetr.r-forge.r-project.org
 SystemRequirements: MonetDB, available from http://www.monetdb.org
-Collate: mapi.R dbi.R dbapply.R dplyr.R control.R
+Collate: mapi.R dbi.R dbapply.R dplyr.R control.R mclient.R
+Additional_repositories: http://dev.monetdb.org/Assets/R/
diff --git a/clients/R/MonetDB.R/NAMESPACE b/clients/R/MonetDB.R/NAMESPACE
--- a/clients/R/MonetDB.R/NAMESPACE
+++ b/clients/R/MonetDB.R/NAMESPACE
@@ -16,6 +16,9 @@ export(monetdb.server.stop)
 export(monetdbd.liststatus)
 export(monetdb.liststatus)
 
+# mclient.R
+export(mclient)
+
 # dplyr.R
 export(src_monetdb)
 export(src_translate_env.src_monetdb)
diff --git a/clients/R/MonetDB.R/NEWS b/clients/R/MonetDB.R/NEWS
--- a/clients/R/MonetDB.R/NEWS
+++ b/clients/R/MonetDB.R/NEWS
@@ -20,6 +20,7 @@ 1.0.0
 - Fixed a bug when dbWriteTable would not adhere to transactional semantics
 - Added transactions to monetdb.read.csv so no empty tables are left over
 - Fixed != comparisions in dplyr (Thanks, David)
+- New "mclient" function to get a shell-like DB interface
 
 0.9.7
 - Fixed crash on Windows (Sorry, everyone)
diff --git a/clients/R/MonetDB.R/R/dbi.R b/clients/R/MonetDB.R/R/dbi.R
--- a/clients/R/MonetDB.R/R/dbi.R
+++ b/clients/R/MonetDB.R/R/dbi.R
@@ -174,7 +174,7 @@ setMethod("dbDisconnect", "MonetDBEmbedd
 
 setMethod("dbListTables", "MonetDBConnection", def=function(conn, ..., 
sys_tables=F, schema_names=F) {
   q <- "select schemas.name as sn, tables.name as tn from sys.tables join 
sys.schemas on tables.schema_id=schemas.id"
-  if (!sys_tables) q <- paste0(q, " where tables.system=false")
+  if (!sys_tables) q <- paste0(q, " where tables.system=false order by sn, tn")
   df <- dbGetQuery(conn, q)
   df$tn <- quoteIfNeeded(conn, df$tn, warn=F)
   res <- df$tn
diff --git a/clients/R/MonetDB.R/R/mclient.R b/clients/R/MonetDB.R/R/mclient.R
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/R/mclient.R
@@ -0,0 +1,27 @@
+mclient <- function(conn, n=20) {
+       res <- NA
+       cat(paste0("Tables: ", paste0(sort(dbListTables(conn)), collapse=", "), 
"\n"))
+       cat("Enter SQL queries or table names below. 'Q' to exit.\n")
+       repeat {
+               tryCatch({
+                       repeat {
+                               query <- readline("sql> ")
+                               if (tolower(query) == "q") {
+                                       return(invisible(TRUE))
+                               }
+                               if (tolower(query) %in% 
tolower(dbListTables(conn))) {
+                                       cat(paste0("Fields in table ", query, 
": ", paste0(dbListFields(conn, query), collapse=", "), "\n"))
+                                       next
+                               }
+                               if (nchar(query) < 5) {
+                                       next
+                               }
+                               res <- dbGetQuery(conn, query)
+                               print(head(res, n))
+                               break
+                       }}
+               , error = function(e) {
+                       message(e, "\n")
+               })
+       }
+}
diff --git a/clients/R/MonetDB.R/man/mclient.Rd 
b/clients/R/MonetDB.R/man/mclient.Rd
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/man/mclient.Rd
@@ -0,0 +1,25 @@
+\name{mclient}
+\alias{mclient}
+
+\title{
+   Run a database shell
+}
+\description{
+  \code{mclient} provides a shell-like database interface.
+}
+\usage{
+mclient(conn, n=20)
+}
+\arguments{
+  \item{conn}{Database connection}
+  \item{n}{Number of rows to show in result sets}
+  }
+\value{
+  No return value to speak of
+}
+
+\examples{
+\dontrun{
+  conn <- dbConnect(MonetDB.R, dbname="demo")
+  mclient(conn)
+}}
diff --git a/clients/R/Tests/dbi.stable.out b/clients/R/Tests/dbi.stable.out
--- a/clients/R/Tests/dbi.stable.out
+++ b/clients/R/Tests/dbi.stable.out
@@ -52,9 +52,7 @@ Ready.
 [1] TRUE
 [1] TRUE
 [1] TRUE
-[1] 150
-[1] 150
-[1] "monetdbtest"                       "\"Need to quote this table name\""
+[1] "\"Need to quote this table name\"" "monetdbtest"                      
 [1] TRUE
 [1] TRUE
 [1] TRUE
diff --git a/clients/R/build-for-cran.sh b/clients/R/build-for-cran.sh
--- a/clients/R/build-for-cran.sh
+++ b/clients/R/build-for-cran.sh
@@ -2,8 +2,8 @@
 
 # set this to a path where the latest svn version or R was installed. 
 # CRAN policies state that R CMD check must use the latest version
-#R=~/r-trunk-install/R.framework/Resources/bin/R
-R=R
+R=~/r-trunk-install/bin/R
+#R=R
 # can't have these in a R package, it wont build
 find MonetDB.R -name "Makefile*" -exec rm {} \;
 find MonetDB.R -name ".DS_Store" -exec rm {} \;
diff --git a/clients/Tests/SQL-dump.stable.out 
b/clients/Tests/SQL-dump.stable.out
--- a/clients/Tests/SQL-dump.stable.out
+++ b/clients/Tests/SQL-dump.stable.out
@@ -1869,7 +1869,6 @@ CREATE TABLE "sys"."args" (
        "number"      INTEGER
 );
 COPY 3799 RECORDS INTO "sys"."args" FROM stdin USING DELIMITERS '\t','\n','"';
-======= end
 2155   28      "res_0" "oid"   63      0       0       0
 2156   28      "arg_1" "wrd"   64      0       1       1
 2157   29      "res_0" "oid"   63      0       0       0
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2342,7 +2342,6 @@ char monet_characteristics[PATHLENGTH];
 char monet_cwd[PATHLENGTH];
 size_t monet_memory;
 void moveInstruction(MalBlkPtr mb, int pc, int target);
-int mtProp;
 str mtimeRef;
 str mulRef;
 str multicolumnRef;
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1218,8 +1218,7 @@ static void
 TIMERrenderer(MapiHdl hdl)
 {
        SQLqueryEcho(hdl);
-       while (fetch_line(hdl) != 0)
-               ;
+       mapi_next_result(hdl);
        printf("%s\n", timerHuman());
 }
 
@@ -2135,11 +2134,19 @@ myread(void *private, void *buf, size_t 
        if (size == 0)
                return cnt;
        if (p->buf == NULL) {
+               rl_completion_func_t *func = NULL;
+
+               if (strcmp(p->prompt, "more>") == 0)
+                       func = suspend_completion();
                p->buf = readline(p->prompt);
+               if (func)
+                       continue_completion(func);
                if (p->buf == NULL)
                        return 0;
                p->len = strlen(p->buf);
                p->read = 0;
+               if (p->len > 1)
+                       save_line(p->buf);
        }
        if (p->read < p->len) {
                if (p->len - p->read < size)
@@ -2154,7 +2161,6 @@ myread(void *private, void *buf, size_t 
                free(p->buf);
                p->buf = NULL;
        }
-       ((char *) buf)[cpsize] = '\0';
        return cpsize / elmsize;
 }
 
@@ -2195,6 +2201,7 @@ doFile(Mapi mid, stream *fp, int useinse
 #ifdef HAVE_LIBREADLINE
                init_readline(mid, language, save_history);
                rl.s = fp;
+               rl.buf = NULL;
                fp = callback_stream(&rl, myread, NULL, mydestroy, 
mnstr_name(fp));
 #endif
        }
@@ -3260,6 +3267,9 @@ main(int argc, char **argv)
                        setFormatter("raw");
                }
        }
+       if (formatter == TIMERformatter) {
+               mapi_cache_limit(mid, 1);
+       }
        /* give the user a welcome message with some general info */
        if (!has_fileargs && command == NULL && isatty(fileno(stdin))) {
                char *lang;
diff --git a/clients/nodejs/Tests/nodetest.js b/clients/nodejs/Tests/nodetest.js
deleted file mode 100644
--- a/clients/nodejs/Tests/nodetest.js
+++ /dev/null
@@ -1,147 +0,0 @@
-var monetdb = require('../monetdb');
-var assert = require('assert');
-
-var dbport = parseInt(process.argv[2]);
-var dbname = process.argv[3];
-
-/* lets first check some failing connection attempts */
-monetdb.connect({host:'veryinvalidhostnamethathopefullyresolvesnowhere'}, 
function(err) {
-       assert(err);
-});
-
-monetdb.connect({dbname:'nonexist', port:dbport}, function(err) {
-       assert(err);
-});
-
-var failedconn = monetdb.connect({dbname:dbname, user:'nonexist', 
port:dbport}, function(err) {
-       assert(err);
-});
-/* try to query on a failed connection, we need this callback */
-failedconn.query('SELECT 1',function(err,res) {
-       assert(err);
-});
-
-/* now actually connect */
-var conn = monetdb.connect({dbname:dbname, port:dbport, debug: false}, 
function(err) {
-       assert.equal(null, err);
-       assert.equal(conn.env.gdk_dbname, dbname);
-});
-
-
-/* some querying, call chaining */
-conn.query('start transaction').
-       query('create table foo(a int, b float, c clob)').
-       query("insert into foo values 
(42,4.2,'42'),(43,4.3,'43'),(44,4.4,'44'),(45,4.5,'45')");
-
-conn.query('select * from foo', function(err, res) {
-       assert.equal(null, err);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to