Changeset: 9fd0726406f9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9fd0726406f9
Modified Files:
        clients/R/MonetDB.R/DESCRIPTION
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/dbi.R
        clients/R/MonetDB.R/R/mapi.R
        clients/R/Tests/dbapply.reqtests
        clients/R/Tests/dbi.R
        clients/R/Tests/dbi.stable.err
        clients/R/Tests/dbi.stable.out
        clients/R/Tests/dplyr.reqtests
        clients/R/Tests/survey.reqtests
Branch: pyapi
Log Message:

Merge with default.


diffs (truncated from 334 to 300 lines):

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
@@ -1,5 +1,5 @@
 Package: MonetDB.R
-Version: 0.9.8
+Version: 1.0.0
 Title: Connect MonetDB to R
 Authors@R: c(person("Hannes Muehleisen", role = c("aut", "cre"),email = 
"han...@cwi.nl"),
        person("Thomas Lumley", role = "ctb"),
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
@@ -1,10 +1,13 @@
-0.9.8
+1.0.0
 - Added support for esoteric data types such as MONTH_INTERVAL (Thanks, Roman)
 - Cleaned up SQL to R type mapping (we had this twice)
 - Now creating actual R integers if data fits
 - dbWriteTable now quotes table/column names if necessary, and outputs 
warnings if it did
 - New mdbapply function to automatically create and run embedded R functions 
in MonetDB
-- Fixes for dplyr backend
+- Fixes for dplyr backend (Thanks, Anthony)
+- Fix for case when query only returns a prompt (CALL ..., Thanks, Roman)
+- Fix for empty result set on dbGetQuery(), no longer returning NULL (Thanks, 
Fabian)
+- Fix for dbConnect(), it ignored the url parameter somehow, which broke some 
sqlsurvey (Thanks, Anthony)
 
 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
@@ -46,8 +46,8 @@ setMethod("dbConnect", "MonetDBDriver", 
                                                      password="monetdb", 
host="localhost", port=50000L, timeout=86400L, wait=FALSE, language="sql", 
                                                      ..., url="") {
   
-  if (substring(dbname, 1, 10) == "monetdb://") {
-    url <- dbname
+  if (substring(url, 1, 10) == "monetdb://") {
+    dbname <- url
   }
   timeout <- as.integer(timeout)
   
@@ -220,8 +220,7 @@ setMethod("dbReadTable", "MonetDBConnect
 
 # This one does all the work in this class
 setMethod("dbSendQuery", signature(conn="MonetDBConnection", 
statement="character"),  
-          def=function(conn, statement, ..., list=NULL, async=FALSE) {
-            
+          def=function(conn, statement, ..., list=NULL, async=FALSE) {   
   if(!is.null(list) || length(list(...))){
     if (length(list(...))) statement <- .bindParameters(statement, list(...))
     if (!is.null(list)) statement <- .bindParameters(statement, list)
@@ -245,11 +244,11 @@ setMethod("dbSendQuery", signature(conn=
     env$data <- resp$tuples
     resp$tuples <- NULL # clean up
     env$info <- resp
-    env$delivered <- 0
+    env$delivered <- -1
     env$query <- statement
     env$open <- TRUE
   }
-  if (resp$type == Q_UPDATE || resp$type == Q_CREATE || resp$type == 
MSG_ASYNC_REPLY) {
+  if (resp$type == Q_UPDATE || resp$type == Q_CREATE || resp$type == 
MSG_ASYNC_REPLY || resp$type == MSG_PROMPT) {
     env$success = TRUE
     env$conn <- conn
     env$query <- statement
@@ -288,15 +287,15 @@ setMethod("dbSendQuery", signature(conn=
 
 # quoting
 quoteIfNeeded <- function(conn, x, ...) {
-  chars <- !grepl("^[A-Za-z][A-Za-z0-9_]*$", x, perl=T) && 
!grepl("^\"[^\"]*\"$", x, perl=T)
+  chars <- !grepl("^[a-z][a-z0-9_]*$", x, perl=T) & !grepl("^\"[^\"]*\"$", x, 
perl=T)
   if (any(chars)) {
-    message("Identifier(s) ", paste(x[chars], collapse=", "), " contain 
reserved SQL characters and need to be quoted.")
+    message("Identifier(s) ", paste(x[chars], collapse=", "), " contain 
uppercase or reserved SQL characters and need(s) to be quoted in queries.")
   }
   reserved <- toupper(x) %in% .SQL92Keywords
   if (any(reserved)) {
-    message("Identifier(s) ", paste(x[reserved], collapse=", "), " are 
reserved SQL keywords and need to be quoted.")
+    message("Identifier(s) ", paste(x[reserved], collapse=", "), " are 
reserved SQL keywords and need(s) to be quoted in queries.")
   }
-  qts <- reserved || chars
+  qts <- reserved | chars
   x[qts] <- dbQuoteIdentifier(conn, x[qts])
   x
 }
@@ -483,6 +482,9 @@ setMethod("dbFetch", signature(res="Mone
   
   # okay, so we arrive here with the tuples from the first result in 
res@env$data as a list
   info <- res@env$info
+  if (res@env$delivered < 0) {
+    res@env$delivered <- 0
+  }
   stopifnot(res@env$delivered <= info$rows, info$index <= info$rows)
   remaining <- info$rows - res@env$delivered
     
@@ -523,7 +525,7 @@ setMethod("dbFetch", signature(res="Mone
   
   # we have delivered everything, return empty df (spec is not clear on this 
one...)
   if (n < 1) {
-    return(data.frame(df))
+    return(data.frame(df, stringsAsFactors=F))
   }
   
   # if our tuple cache in res@env$data does not contain n rows, we fetch from 
server until it does
@@ -576,7 +578,6 @@ setMethod("dbFetch", signature(res="Mone
   class(df) <- "data.frame"
   
   # if (getOption("monetdb.profile", T))  .profiler_clear()
-
   df
 })
 
diff --git a/clients/R/MonetDB.R/R/mapi.R b/clients/R/MonetDB.R/R/mapi.R
--- a/clients/R/MonetDB.R/R/mapi.R
+++ b/clients/R/MonetDB.R/R/mapi.R
@@ -159,7 +159,9 @@ REPLY_SIZE    <- 100 # Apparently, -1 me
 
 # determines and partially parses the answer from the server in response to a 
query
 .mapiParseResponse <- function(response) {
-  #lines <- .Call("mapiSplitLines", response, PACKAGE="MonetDB.R")
+  if (response == MSG_PROMPT) { # prompt
+    return(list(type = MSG_PROMPT))
+  }
   lines <- strsplit(response, "\n", fixed=TRUE, useBytes=TRUE)[[1]]
   if (length(lines) < 1) {
     stop("Invalid response from server. Try re-connecting.")
diff --git a/clients/R/Tests/dbapply.reqtests b/clients/R/Tests/dbapply.reqtests
--- a/clients/R/Tests/dbapply.reqtests
+++ b/clients/R/Tests/dbapply.reqtests
@@ -1,1 +1,2 @@
 install
+dbi
diff --git a/clients/R/Tests/dbi.R b/clients/R/Tests/dbi.R
--- a/clients/R/Tests/dbi.R
+++ b/clients/R/Tests/dbi.R
@@ -53,7 +53,6 @@ dbWriteTable(con,tname,iris)
 stopifnot(identical(dbExistsTable(con,tname),TRUE))
 stopifnot(identical(dbExistsTable(con,"monetdbtest2"),FALSE))
 stopifnot(tname %in% dbListTables(con))
-
 stopifnot(identical(dbListFields(con,tname),names(iris)))
 # get stuff, first very convenient
 iris2 <- dbReadTable(con,tname)
@@ -174,10 +173,23 @@ stopifnot(identical(1L, as.integer(dbGet
 # reserved words in data frame column names
 stopifnot(dbIsValid(conn))
 dbBegin(conn)
-dbWriteTable(conn, "evilt", data.frame(year=42, month=12, day=24), 
transaction=F)
+dbWriteTable(conn, "evilt", data.frame(year=42, month=12, day=24, 
some.dot=12), transaction=F)
 stopifnot(dbExistsTable(conn, "evilt"))
 dbRollback(conn)
 
+# evil table from survey
+stopifnot(dbIsValid(conn))
+dbBegin(conn)
+data(api, package="survey")
+x <- apiclus1
+x$idkey <- seq( nrow( x ) )
+dbWriteTable( conn , 'x' , x , transaction=F)
+stopifnot(dbExistsTable(conn, "x"))
+dbRollback(conn)
+
+# empty result set
+stopifnot(!is.null(dbGetQuery(conn, "SELECT * FROM tables WHERE 1=0")))
+
 stopifnot(dbIsValid(conn))
 #thrice to catch null pointer errors
 stopifnot(identical(dbDisconnect(con),TRUE))
diff --git a/clients/R/Tests/dbi.stable.err b/clients/R/Tests/dbi.stable.err
--- a/clients/R/Tests/dbi.stable.err
+++ b/clients/R/Tests/dbi.stable.err
@@ -1,11 +1,11 @@
 stderr of test 'dbi` in directory 'clients/R` itself:
 
 
-# 16:49:50 >  
-# 16:49:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=36003" "--set" 
"mapi_usock=/var/tmp/mtest-66827/.s.monetdb.36003" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/Users/hannes/monetdb-install/var/MonetDB/mTests_clients_R" "--set" 
"mal_listing=0" "--set" "embedded_r=yes"
-# 16:49:50 >  
+# 12:27:25 >  
+# 12:27:25 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31728" "--set" 
"mapi_usock=/var/tmp/mtest-43693/.s.monetdb.31728" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/Users/hannes/monetdb-install/var/MonetDB/mTests_clients_R" "--set" 
"mal_listing=0" "--set" "embedded_r=yes"
+# 12:27:25 >  
 
-# builtin opt  gdk_dbpath = 
/Users/hannes/monetdb-install/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_dbpath = 
/usr/local/Cellar/monetdb/11.19.9/var/monetdb5/dbfarm/demo
 # builtin opt  gdk_debug = 0
 # builtin opt  gdk_vmtrim = no
 # builtin opt  monet_prompt = >
@@ -17,8 +17,8 @@ stderr of test 'dbi` in directory 'clien
 # builtin opt  sql_debug = 0
 # cmdline opt  gdk_nr_threads = 0
 # cmdline opt  mapi_open = true
-# cmdline opt  mapi_port = 36003
-# cmdline opt  mapi_usock = /var/tmp/mtest-66827/.s.monetdb.36003
+# cmdline opt  mapi_port = 31728
+# cmdline opt  mapi_usock = /var/tmp/mtest-43693/.s.monetdb.31728
 # cmdline opt  monet_prompt = 
 # cmdline opt  mal_listing = 2
 # cmdline opt  gdk_dbpath = 
/Users/hannes/monetdb-install/var/MonetDB/mTests_clients_R
@@ -26,15 +26,18 @@ stderr of test 'dbi` in directory 'clien
 # cmdline opt  embedded_r = yes
 # cmdline opt  gdk_debug = 536870922
 
-# 16:49:50 >  
-# 16:49:50 >  "R" "--vanilla" "--slave" "--args" "36003"
-# 16:49:50 >  
+# 12:27:25 >  
+# 12:27:25 >  "R" "--vanilla" "--slave" "--args" "31728"
+# 12:27:25 >  
 
-Identifier(s) Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species 
contain reserved SQL characters and need to be quoted.
-Identifier(s) Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species 
contain reserved SQL characters and need to be quoted.
-Identifier(s) year, month, day are reserved SQL keywords and need to be quoted.
+Identifier(s) Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species 
contain uppercase or reserved SQL characters and need(s) to be quoted in 
queries.
+Identifier(s) Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species 
contain uppercase or reserved SQL characters and need(s) to be quoted in 
queries.
+Identifier(s) some.dot contain uppercase or reserved SQL characters and 
need(s) to be quoted in queries.
+Identifier(s) year, month, day are reserved SQL keywords and need(s) to be 
quoted in queries.
+Identifier(s) sch.wide, comp.imp, yr.rnd, acs.k3, acs.46, acs.core, pct.resp, 
not.hsg, some.col, col.grad, grad.sch, avg.ed, api.stu contain uppercase or 
reserved SQL characters and need(s) to be quoted in queries.
+Identifier(s) full are reserved SQL keywords and need(s) to be quoted in 
queries.
 
-# 16:49:52 >  
-# 16:49:52 >  "Done."
-# 16:49:52 >  
+# 12:27:27 >  
+# 12:27:27 >  "Done."
+# 12:27:27 >  
 
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
@@ -1,25 +1,20 @@
 stdout of test 'dbi` in directory 'clients/R` itself:
 
 
-# 16:49:50 >  
-# 16:49:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=36003" "--set" 
"mapi_usock=/var/tmp/mtest-66827/.s.monetdb.36003" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/Users/hannes/monetdb-install/var/MonetDB/mTests_clients_R" "--set" 
"mal_listing=0" "--set" "embedded_r=yes"
-# 16:49:50 >  
+# 12:26:31 >  
+# 12:26:31 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31372" "--set" 
"mapi_usock=/var/tmp/mtest-43570/.s.monetdb.31372" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/Users/hannes/monetdb-install/var/MonetDB/mTests_clients_R" "--set" 
"mal_listing=0" "--set" "embedded_r=yes"
+# 12:26:31 >  
 
-# MonetDB 5 server v11.22.0
-# This is an unreleased version
-# Serving database 'mTests_clients_R', using 4 threads
-# Compiled for x86_64-apple-darwin14.3.0/64bit with 64bit OIDs and 128bit 
integers dynamically linked
+# MonetDB 5 server v11.19.9 "Oct2014-SP2"
+# Serving database 'mTests_clients_R', using 8 threads
+# Compiled for x86_64-apple-darwin14.1.0/64bit with 64bit OIDs dynamically 
linked
 # Found 16.000 GiB available main-memory.
 # Copyright (c) 1993-July 2008 CWI.
 # Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
 # Visit http://www.monetdb.org/ for further information
-# Listening for connection requests on 
mapi:monetdb://dakar.da.cwi.nl.hhk.dk:36003/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-66827/.s.monetdb.36003
-# MonetDB/GIS module loaded
-# Start processing logs sql/sql_logs version 52200
-# Finished processing logs sql/sql_logs
+# Listening for connection requests on mapi:monetdb://herbert2.local:31372/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-43570/.s.monetdb.31372
 # MonetDB/SQL module loaded
-# MonetDB/R   module loaded
 
 Ready.
 # SQL catalog created, loading sql scripts once
@@ -31,7 +26,7 @@ Ready.
 # loading sql script: 14_inet.sql
 # loading sql script: 15_querylog.sql
 # loading sql script: 16_tracelog.sql
-# loading sql script: 17_temporal.sql
+# loading sql script: 19_cluster.sql
 # loading sql script: 20_vacuum.sql
 # loading sql script: 21_dependency_functions.sql
 # loading sql script: 22_clients.sql
@@ -39,27 +34,19 @@ Ready.
 # loading sql script: 24_zorder.sql
 # loading sql script: 25_debug.sql
 # loading sql script: 26_sysmon.sql
-# loading sql script: 27_rejects.sql
 # loading sql script: 39_analytics.sql
-# loading sql script: 39_analytics_hge.sql
-# loading sql script: 40_geom.sql
 # loading sql script: 40_json.sql
-# loading sql script: 40_json_hge.sql
-# loading sql script: 41_md5sum.sql
+# loading sql script: 41_jsonstore.sql
 # loading sql script: 45_uuid.sql
-# loading sql script: 46_gsl.sql
-# loading sql script: 51_sys_schema_extension.sql
 # loading sql script: 75_storagemodel.sql
 # loading sql script: 80_statistics.sql
 # loading sql script: 80_udf.sql
-# loading sql script: 80_udf_hge.sql
 # loading sql script: 90_generator.sql
-# loading sql script: 90_generator_hge.sql
 # loading sql script: 99_system.sql
 
-# 16:49:50 >  
-# 16:49:50 >  "R" "--vanilla" "--slave" "--args" "36003"
-# 16:49:50 >  
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to