Changeset: 36e98faec377 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=36e98faec377
Added Files:
        clients/Tests/malcheck.sh
        clients/Tests/malcheck.stable.err
        clients/Tests/malcheck.stable.out
        clients/Tests/malcheck.timeout
        sql/test/BugTracker-2014/Tests/sign-sorted.Bug-3594.sql
        sql/test/BugTracker-2014/Tests/sign-sorted.Bug-3594.stable.err
        sql/test/BugTracker-2014/Tests/sign-sorted.Bug-3594.stable.out
        testing/malcheck.py
Removed Files:
        clients/R/MonetDB.R/man/monetdbGetTransferredBytes.Rd
Modified Files:
        clients/R/MonetDB.R/DESCRIPTION
        clients/R/MonetDB.R/NAMESPACE
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/dbi.R
        clients/R/MonetDB.R/R/dplyr.R
        clients/R/MonetDB.R/R/mapi.R
        clients/R/Tests/dbi.R
        clients/R/Tests/dbi.stable.out
        clients/R/Tests/dplyr.R
        clients/R/Tests/dplyr.stable.err
        clients/R/Tests/dplyr.stable.out
        clients/R/Tests/install-dependencies.sh
        clients/R/Tests/install.sh
        clients/R/Tests/survey.R
        clients/Tests/All
        clients/Tests/MAL-signatures_all.stable.out
        clients/Tests/MAL-signatures_fits_geom.stable.out
        clients/Tests/MAL-signatures_geom.stable.out
        clients/Tests/MAL-signatures_none.stable.out
        clients/Tests/exports.stable.out
        gdk/gdk_calc.c
        geom/monetdb5/geom.c
        java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
        monetdb5/NT/M5server.bat
        monetdb5/extras/rdf/rdf.h
        monetdb5/extras/rdf/rdfalgebra.c
        monetdb5/extras/sphinx/sphinx.c
        monetdb5/extras/sphinx/sphinx.h
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/atoms/mtime.mal
        monetdb5/modules/kernel/bat5.mal
        monetdb5/modules/kernel/mmath.c
        monetdb5/modules/kernel/mmath.h
        monetdb5/modules/kernel/mmath.mal
        monetdb5/modules/mal/Tests/inspect05.stable.out
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/mal_mapi.h
        sql/backends/monet5/datacell/opt_datacell.c
        sql/backends/monet5/datacell/opt_datacell.h
        sql/backends/monet5/sql_cast.h
        sql/backends/monet5/sql_cast_impl_down_from_flt.h
        sql/backends/monet5/sql_cast_impl_down_from_int.h
        sql/backends/monet5/sql_cast_impl_up_to_flt.h
        sql/backends/monet5/sql_cast_impl_up_to_int.h
        sql/test/BugTracker-2014/Tests/All
        testing/Makefile.ag
        testing/Mtest.py.in
        testing/exportutils.py
        testing/listexports.py.in
        tools/merovingian/daemon/forkmserver.c
        tools/merovingian/utils/properties.c
        tools/merovingian/utils/properties.h
        tools/merovingian/utils/utils.c
        tools/merovingian/utils/utils.h
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (truncated from 3598 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
@@ -4,14 +4,11 @@ Title: Connect MonetDB to R
 Authors@R: c(person("Hannes Muehleisen", role = c("aut", "cre"),email = 
"han...@cwi.nl"),
        person("Thomas Lumley", role = "ctb"),
        person("Anthony Damico", role = "ctb"))
-Depends: DBI (>= 0.3), digest (>= 0.6.4), bitops (>= 1.0), methods
-Suggests: dplyr(>= 0.2.0.9000)
-Description: Allows to pull data from MonetDB into R
+Author: Hannes Muehleisen [aut, cre], Thomas Lumley [ctb], Anthony Damico [ctb]
+Maintainer: Hannes Muehleisen <han...@cwi.nl>
+Depends: DBI (>= 0.3.1), digest (>= 0.6.4), methods, R (>= 3.1.1)
+Suggests: dplyr
+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
-Maintainer: Hannes Muehleisen <han...@cwi.nl>
-SystemRequirements: MonetDB installation, available at
-        http://www.monetdb.org
-Author: Hannes Muehleisen [aut, cre],
-  Thomas Lumley [ctb],
-  Anthony Damico [ctb]
+SystemRequirements: MonetDB, available from http://www.monetdb.org
\ No newline at end of file
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
@@ -1,10 +1,10 @@
-import(DBI,digest,methods,bitops)
+import(DBI,digest,methods)
 
 # export only driver constructor, everything else is DBI stuff..
 export(MonetDB,MonetR,MonetDBR,MonetDB.R)
 export(monet.read.csv,monetdb.read.csv)
 # this one is not in the DBI
-exportMethods(dbSendUpdate,dbSendUpdateAsync,dbTransaction,dbIsValid)
+exportMethods(dbSendUpdate,dbSendUpdateAsync,dbTransaction)
 # shorthands
 export(mc,mq)
 
@@ -18,8 +18,8 @@ useDynLib(MonetDB.R)
 
 # dplyr.R
 export(src_monetdb)
-export(translate_env.src_monetdb)
-export(brief_desc.src_monetdb)
+export(src_translate_env.src_monetdb)
+export(src_desc.src_monetdb)
 export(tbl.src_monetdb)
 export(db_query_fields.MonetDBConnection)
 export(db_query_rows.MonetDBConnection)
@@ -27,5 +27,6 @@ export(db_save_query.MonetDBConnection)
 export(db_insert_into.MonetDBConnection)
 export(db_create_index.MonetDBConnection)
 export(db_analyze.MonetDBConnection)
-export(db_begin.MonetDBConnection)
 export(sql_subquery.MonetDBConnection)
+export(sql_join.MonetDBConnection)
+export(monetdb_queryinfo)
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,12 +1,12 @@
 0.9.5
-- Fixed package date (Thanks, Dimitar)
+- Removed package date (Thanks, Dimitar)
 - Added sys. schema name to internal queries, so SET SCHEMA xx would not break 
things (Thanks again, Dimitar)
 - Fixed monetdb:// URL handling on newer R versions (Thanks, Alex)
 - DBI 0.3 compatibility (isValid etc.)
 - deprecated dbTransaction() (DBI has standardized dbBegin())
 - Back to R socket code for peace of mind
 - Code cleanup
-- dplyr integration moved to MonetDB.R
+- dplyr integration moved to MonetDB.R package
 
 0.9.4
 - dbWriteTable overhaul (thanks, Anthony)
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
@@ -18,17 +18,12 @@ MonetR <- MonetDB <- MonetDBR <- MonetDB
   new("MonetDBDriver")
 }
 
-# dbIsValid is missing from the DBI 0.3, so redefine
-setGeneric("dbIsValid", 
-  def = function(dbObj, ...) standardGeneric("dbIsValid"),
-  valueClass = "logical")
-
 setMethod("dbIsValid", "MonetDBDriver", def=function(dbObj, ...) {
-  return(TRUE) # driver object cannot be invalid
+  return(invisible(TRUE)) # driver object cannot be invalid
 })
 
 setMethod("dbUnloadDriver", "MonetDBDriver", def=function(drv, ...) {
-  return(TRUE) # there is nothing to really unload here...
+  return(invisible(TRUE)) # there is nothing to really unload here...
 })
 
 setMethod("dbGetInfo", "MonetDBDriver", def=function(dbObj, ...)
@@ -124,7 +119,7 @@ setMethod("dbConnect", "MonetDBDriver", 
   }
   
   # make new socket with user-specified timeout
-  socket <- .mapiConnect(host, port, 5) 
+  socket <- .mapiConnect(host, port, timeout) 
   .mapiAuthenticate(socket, dbname, user, password, language=language)
   connenv <- new.env(parent=emptyenv())
   connenv$lock <- 0
@@ -156,7 +151,7 @@ setMethod("dbGetInfo", "MonetDBConnectio
 })
 
 setMethod("dbIsValid", "MonetDBConnection", def=function(dbObj, ...) {
-  return(!is.na(tryCatch(dbGetInfo(dbObj), error=function(e){NA})))
+  return(invisible(!is.na(tryCatch({dbGetInfo(dbObj);TRUE}, 
error=function(e){NA}))))
 })
 
 setMethod("dbDisconnect", "MonetDBConnection", def=function(conn, ...) {
@@ -214,8 +209,9 @@ setMethod("dbListFields", "MonetDBConnec
 })
 
 setMethod("dbExistsTable", "MonetDBConnection", def=function(conn, name, ...) {
-  #TODO: make this work with more cases
-  tolower(name) %in% tolower(dbListTables(conn,sys_tables=T))
+  # TODO: this is evil... 
+  return(tolower(gsub("(^\"|\"$)","",as.character(name))) %in% 
+    tolower(dbListTables(conn,sys_tables=T)))
 })
 
 setMethod("dbGetException", "MonetDBConnection", def=function(conn, ...) {
@@ -225,7 +221,7 @@ setMethod("dbGetException", "MonetDBConn
 setMethod("dbReadTable", "MonetDBConnection", def=function(conn, name, ...) {
   if (!dbExistsTable(conn, name))
     stop(paste0("Unknown table: ", name));
-  dbGetQuery(conn, paste0("SELECT * FROM ", name))
+  dbGetQuery(conn,paste0("SELECT * FROM ", name))
 })
 
 # This one does all the work in this class
@@ -315,7 +311,7 @@ setMethod("dbWriteTable", "MonetDBConnec
   if (overwrite && append) {
     stop("Setting both overwrite and append to true makes no sense.")
   }
-  qname <- dbQuoteIdentifier(conn, name)
+  qname <- make.db.names(conn, name)
   if (dbExistsTable(conn, qname)) {
     if (overwrite) dbRemoveTable(conn, qname)
     if (!overwrite && !append) stop("Table ", qname, " already exists. Set 
overwrite=TRUE if you want 
@@ -324,7 +320,7 @@ setMethod("dbWriteTable", "MonetDBConnec
   }
   if (!dbExistsTable(conn, qname)) {
     fts <- sapply(value, dbDataType, dbObj=conn)
-    fdef <- paste(dbQuoteIdentifier(conn, names(value)), fts, collapse=', ')
+    fdef <- paste(make.db.names(conn, names(value)), fts, collapse=', ')
     ct <- paste("CREATE TABLE ", qname, " (", fdef, ")", sep= '')
     dbSendUpdate(conn, ct)
   }
@@ -580,21 +576,21 @@ setMethod("dbClearResult", "MonetDBResul
       res@env$open <- FALSE
     }
   }
-  invisible(TRUE)
+  return(invisible(TRUE))
 }, valueClass = "logical")
 
 setMethod("dbHasCompleted", "MonetDBResult", def = function(res, ...) {
   if (res@env$info$type == Q_TABLE) {
     return(res@env$delivered == res@env$info$rows)
   }
-  return(TRUE)
+  return(invisible(TRUE))
 }, valueClass = "logical")
 
 setMethod("dbIsValid", signature(dbObj="MonetDBResult"), def=function(dbObj, 
...) {
   if (dbObj@env$info$type == Q_TABLE) {
     return(dbObj@env$open)
   }
-  return(TRUE)
+  return(invisible(TRUE))
 })
 
 monetTypes <- rep(c("numeric", "character", "character", "logical", "raw"), 
c(9, 3, 4, 1, 1))
diff --git a/clients/R/MonetDB.R/R/dplyr.R b/clients/R/MonetDB.R/R/dplyr.R
--- a/clients/R/MonetDB.R/R/dplyr.R
+++ b/clients/R/MonetDB.R/R/dplyr.R
@@ -5,7 +5,7 @@ src_monetdb <- function(dbname, host = "
   src_sql("monetdb", con, info = dbGetInfo(con))
 }
 
-translate_env.src_monetdb <- function(x) {
+src_translate_env.src_monetdb <- function(x) {
   sql_variant(
     base_scalar,
     sql_translator(.parent = base_agg,
@@ -17,20 +17,22 @@ translate_env.src_monetdb <- function(x)
   )
 }
 
-brief_desc.src_monetdb <- function(x) {
+sql_join.MonetDBConnection <- function(con, x, y, type = "inner", by = NULL, 
...) {
+  NextMethod("sql_join",...)
+}
+
+src_desc.src_monetdb <- function(x) {
   paste0("MonetDB ",x$info$monet_version, " (",x$info$monet_release, ") [", 
x$info$merovingian_uri,"]")
 }
 
 tbl.src_monetdb <- function(src, from, ...) {
   monetdb_check_subquery(from)
-  tbl_sql("mownetdb", src = src, from = from, ...)
+  tbl_sql("monetdb", src = src, from = from, ...)
 }
 
-# sql_create_index.src_monetdb
-
 db_query_fields.MonetDBConnection <- function(con, sql, ...) {
-  # prepare gives us column info without actually running a query
-  dbGetQuery(con,build_sql("PREPARE SELECT * FROM ", ident(sql)))$column
+  # prepare gives us column info without actually running a query. Nice.
+  dbGetQuery(con, build_sql("PREPARE SELECT * FROM ", sql))$column
 }
 
 db_query_rows.MonetDBConnection <- function(con, sql, ...) {
@@ -38,7 +40,8 @@ db_query_rows.MonetDBConnection <- funct
 }
 
 db_insert_into.MonetDBConnection <- function(con, table, values, ...) {
-  dbWriteTable(con,table,values,append=T,transaction=F,csvdump=T)
+  dbWriteTable(con,dbQuoteIdentifier(con,table),values,
+    append=T,transaction=F,csvdump=T)
 }
 
 db_save_query.MonetDBConnection <- function(con, sql, name, temporary = TRUE,
@@ -49,10 +52,6 @@ db_save_query.MonetDBConnection <- funct
   name
 }
 
-db_begin.MonetDBConnection <- function(con, ...) {
-  dbBegin(con)
-}
-
 db_create_index.MonetDBConnection <- function(con, table, columns, name = NULL,
                                            ...) {
   TRUE
@@ -62,9 +61,6 @@ db_analyze.MonetDBConnection <- function
   TRUE
 }
 
-# this should be the default in dplyr anyways...
-db_begin.MonetDBConnection <- function(con, ...) dbBegin(con)
-
 sql_subquery.MonetDBConnection <- function(con, sql, name = unique_name(), 
...) {
   if (is.ident(sql)) return(sql)
   monetdb_check_subquery(sql)
@@ -91,4 +87,14 @@ monetdb_queryinfo <- function(conn, quer
     .mapiRequest(conn, paste0("Xreply_size ", REPLY_SIZE))
   })
   info
-}
\ No newline at end of file
+}
+
+# copied from dplyr's utils.r, sql_subquery needs it
+unique_name <- local({
+  i <- 0
+
+  function() {
+    i <<- i + 1
+    paste0("_W", i)
+  }
+})
\ No newline at end of file
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
@@ -134,8 +134,8 @@ REPLY_SIZE    <- 100 # Apparently, -1 me
         stop("Empty response from MonetDB server, probably a timeout. You can 
increase the time to wait for responses with the 'timeout' parameter to 
'dbConnect()'.")
       }
       
-      length <- bitShiftR(unpacked,1)
-      final <- bitAnd(unpacked,1)
+      length <- bitwShiftR(unpacked,1)
+      final  <- bitwAnd(unpacked,1)
           
       if (length == 0) break
       resp <- c(resp,readChar(con, length, useBytes = TRUE))    
@@ -167,7 +167,7 @@ REPLY_SIZE    <- 100 # Apparently, -1 me
       bytes <- nchar(req)
       pos <- pos + bytes
       final <- max(nchar(msg) - pos,0) == 0            
-      header <- as.integer(bitOr(bitShiftL(bytes,1),as.numeric(final)))
+      header <- as.integer(bitwOr(bitwShiftL(bytes,1),as.numeric(final)))
       writeBin(header, con, 2,endian="little")
       writeChar(req,con,bytes,useBytes=TRUE,eos=NULL)
     }
@@ -192,7 +192,9 @@ REPLY_SIZE    <- 100 # Apparently, -1 me
 .mapiParseResponse <- function(response) {
   #lines <- .Call("mapiSplitLines", response, PACKAGE="MonetDB.R")
   lines <- strsplit(response, "\n", fixed=TRUE, useBytes=TRUE)[[1]]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to