Changeset: c4e4462a6964 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c4e4462a6964 Added Files: clients/R/MonetDB.R/man/dbTransaction.Rd clients/R/MonetDB.R/man/monetdb_queryinfo.Rd clients/R/MonetDB.R/man/mq.Rd gdk/gdk_firstn.c monetdb5/tests/gdkTests/Tests/firstn.mal monetdb5/tests/gdkTests/Tests/firstn.stable.err monetdb5/tests/gdkTests/Tests/firstn.stable.out sql/test/BugTracker-2014/Tests/stringfloatshtcompare.Bug-3512.sql Removed Files: monetdb5/modules/mal/pqueue.c monetdb5/modules/mal/pqueue.h monetdb5/modules/mal/pqueue.mal Modified Files: MonetDB.spec NT/installer32/MonetDB5-SQL-Installer.vdproj NT/installer64/MonetDB5-SQL-Installer.vdproj NT/monetdb_config.h.in clients/R/MonetDB.R/DESCRIPTION clients/R/MonetDB.R/NEWS clients/R/MonetDB.R/R/monetdb.R clients/R/db.tests/monetdb.test.R clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures_gsl.stable.out clients/Tests/MAL-signatures_nocfitsio.stable.out clients/Tests/MAL-signatures_sphinxclient.stable.out clients/Tests/exports.stable.out configure.ag gdk/ChangeLog gdk/Makefile.ag gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_bbp.h gdk/gdk_calc.c gdk/gdk_calc_compare.h gdk/gdk_cross.c gdk/gdk_delta.c gdk/gdk_group.c gdk/gdk_heap.c gdk/gdk_join.c gdk/gdk_join_legacy.c gdk/gdk_logger.c gdk/gdk_private.h gdk/gdk_sample.c gdk/gdk_search.c gdk/gdk_select.c gdk/gdk_setop.c gdk/gdk_storage.c gdk/gdk_tm.c gdk/gdk_unique.c gdk/gdk_utils.c geom/monetdb5/geom.c java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java monetdb5/extras/rdf/rdf_shredder.c monetdb5/extras/rdf/rdfalgebra.c monetdb5/extras/sphinx/sphinx.c monetdb5/mal/Tests/tst1012.mal monetdb5/mal/Tests/tst1012.stable.out monetdb5/mal/mal_authorize.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_linker.c monetdb5/mal/mal_listing.c monetdb5/mal/mal_module.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_type.h monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/str.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/algebra.mal monetdb5/modules/kernel/array.c monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/bat5.h monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/batstr.c monetdb5/modules/kernel/counters.c monetdb5/modules/kernel/microbenchmark.c monetdb5/modules/kernel/status.c monetdb5/modules/mal/Makefile.ag monetdb5/modules/mal/Tests/inspect05.stable.out monetdb5/modules/mal/Tests/pqueue.mal monetdb5/modules/mal/Tests/pqueue.stable.out monetdb5/modules/mal/Tests/pqueue2.mal monetdb5/modules/mal/Tests/pqueue2.stable.out monetdb5/modules/mal/Tests/pqueue3.mal monetdb5/modules/mal/Tests/pqueue3.stable.out monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batExtensions.h monetdb5/modules/mal/batExtensions.mal monetdb5/modules/mal/bbp.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/cluster.c monetdb5/modules/mal/inspect.c monetdb5/modules/mal/mal_init.mal monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/manifold.c monetdb5/modules/mal/mat.c monetdb5/modules/mal/mdb.c monetdb5/modules/mal/mkey.c monetdb5/modules/mal/pcre.c monetdb5/modules/mal/profiler.c monetdb5/modules/mal/querylog.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/sysmon.c monetdb5/modules/mal/tablet.c monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/txtsim.c monetdb5/modules/mal/zorder.c monetdb5/optimizer/opt_centipede.c monetdb5/optimizer/opt_pipes.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_statistics.c monetdb5/optimizer/opt_support.c monetdb5/scheduler/run_octopus.c monetdb5/tests/gdkTests/Tests/All monetdb5/tests/gdkTests/Tests/TMsubcommit.mal monetdb5/tests/gdkTests/Tests/TMsubcommit.stable.out monetdb5/tests/gdkTests/Tests/bat_insert.mal monetdb5/tests/gdkTests/Tests/bat_insert.stable.out monetdb5/tests/gdkTests/Tests/reload.mal monetdb5/tests/gdkTests/Tests/str_heap.mal monetdb5/tests/gdkTests/Tests/str_heap.stable.out monetdb5/tools/Tests/mserver5--help.stable.err sql/backends/monet5/LSST/lsst.c sql/backends/monet5/UDF/udf.c sql/backends/monet5/datacell/basket.c sql/backends/monet5/datacell/dcoperator.c sql/backends/monet5/datacell/emitter.c sql/backends/monet5/datacell/petrinet.c sql/backends/monet5/datacell/receptor.c sql/backends/monet5/generator/generator.c sql/backends/monet5/gsl/gsl.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_bat2time.c sql/backends/monet5/sql_cast.c 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/backends/monet5/sql_fround.c sql/backends/monet5/sql_fround_impl.h sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_optimizer.c sql/backends/monet5/sql_round.c sql/backends/monet5/sql_round_impl.h sql/backends/monet5/sql_scenario.c sql/backends/monet5/vaults/fits.c sql/backends/monet5/vaults/mseed.c sql/benchmarks/tpch/Tests/02-explain.stable.out sql/benchmarks/tpch/Tests/03-explain.stable.out sql/benchmarks/tpch/Tests/10-explain.stable.out sql/benchmarks/tpch/Tests/18-explain.stable.out sql/benchmarks/tpch/Tests/21-explain.stable.out sql/benchmarks/tpch/Tests/21-explain.stable.out.32bit sql/server/rel_select.c sql/server/sql_atom.c sql/server/sql_parser.y sql/storage/bat/bat_logger.c sql/storage/bat/bat_storage.c sql/storage/bat/bat_utils.c sql/storage/bat/bat_utils.h sql/storage/restrict/restrict_storage.c sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out sql/test/pg_regress/Tests/numeric.sql sql/test/pg_regress/Tests/numeric.stable.err sql/test/pg_regress/Tests/numeric.stable.out sql/test/pg_regress/Tests/oid.sql sql/test/pg_regress/Tests/oid.stable.err sql/test/pg_regress/Tests/oid.stable.out sql/test/pg_regress/postgresql2sql99.sh testing/Mtest.py.in tools/mserver/mserver5.1.in tools/mserver/mserver5.c Branch: generator Log Message:
Merge with default branch. diffs (truncated from 21308 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -562,9 +562,9 @@ used from the MAL level. Summary: MonetDB5 SQL server modules Group: Applications/Databases Requires: MonetDB5-server = %{version}-%{release} -%if %{?rhel:0}%{!?rhel:1} -# for systemd-tmpfiles -Requires: systemd-units +%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7 +# RHEL >= 7, and all current Fedora +Requires: %{_bindir}/systemd-tmpfiles %endif Obsoletes: MonetDB-SQL-devel Obsoletes: %{name}-SQL @@ -578,7 +578,7 @@ accelerators. It also has an SQL fronte This package contains the SQL frontend for MonetDB. If you want to use SQL with MonetDB, you will need to install this package. -%if %{?rhel:0}%{!?rhel:1} +%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7 %post SQL-server5 systemd-tmpfiles --create %{_sysconfdir}/tmpfiles.d/monetdbd.conf %endif @@ -588,11 +588,11 @@ systemd-tmpfiles --create %{_sysconfdir} %{_bindir}/monetdb %{_bindir}/monetdbd %dir %attr(775,monetdb,monetdb) %{_localstatedir}/log/monetdb -%if %{?rhel:0}%{!?rhel:1} -# Fedora 15 and newer +%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7 +# RHEL >= 7, and all current Fedora %{_sysconfdir}/tmpfiles.d/monetdbd.conf %else -# RedHat Enterprise Linux +# RedHat Enterprise Linux < 7 %dir %attr(775,monetdb,monetdb) %{_localstatedir}/run/monetdb %exclude %{_sysconfdir}/tmpfiles.d/monetdbd.conf %endif diff --git a/NT/installer32/MonetDB5-SQL-Installer.vdproj b/NT/installer32/MonetDB5-SQL-Installer.vdproj --- a/NT/installer32/MonetDB5-SQL-Installer.vdproj +++ b/NT/installer32/MonetDB5-SQL-Installer.vdproj @@ -927,12 +927,6 @@ } "Entry" { - "MsmKey" = "8:_F4DDA57B13344198B902859413BF2B9D" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { "MsmKey" = "8:_F671CE9CE9A64006AFFFAFBCBDA8EDCE" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -4052,26 +4046,6 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F4DDA57B13344198B902859413BF2B9D" - { - "SourcePath" = "8:lib\\monetdb5\\pqueue.mal" - "TargetName" = "8:pqueue.mal" - "Tag" = "8:" - "Folder" = "8:_B593DAA0787744D6A44D17884E0C3951" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F671CE9CE9A64006AFFFAFBCBDA8EDCE" { "SourcePath" = "8:lib\\monetdb5\\createdb\\23_skyserver.sql" diff --git a/NT/installer64/MonetDB5-SQL-Installer.vdproj b/NT/installer64/MonetDB5-SQL-Installer.vdproj --- a/NT/installer64/MonetDB5-SQL-Installer.vdproj +++ b/NT/installer64/MonetDB5-SQL-Installer.vdproj @@ -927,12 +927,6 @@ } "Entry" { - "MsmKey" = "8:_F4DDA57B13344198B902859413BF2B9D" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { "MsmKey" = "8:_F671CE9CE9A64006AFFFAFBCBDA8EDCE" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -4052,26 +4046,6 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F4DDA57B13344198B902859413BF2B9D" - { - "SourcePath" = "8:lib\\monetdb5\\pqueue.mal" - "TargetName" = "8:pqueue.mal" - "Tag" = "8:" - "Folder" = "8:_B593DAA0787744D6A44D17884E0C3951" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F671CE9CE9A64006AFFFAFBCBDA8EDCE" { "SourcePath" = "8:lib\\monetdb5\\createdb\\23_skyserver.sql" diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in --- a/NT/monetdb_config.h.in +++ b/NT/monetdb_config.h.in @@ -745,9 +745,12 @@ #undef fstat #endif #define fstat _fstat64 -#ifndef S_ISREG /* in case this file wasn't included first */ +#ifndef S_ISREG #define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG) #endif +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR) +#endif /* Define to the sub-directory in which libtool stores uninstalled libraries. */ 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,6 +1,6 @@ Package: MonetDB.R -Version: 0.9.3 -Date: 2013-06-12 +Version: 0.9.4 +Date: 2013-07-14 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,3 +1,6 @@ +0.9.4 +- dbWriteTable overhaul (thanks, Anthony) + 0.9.3 - Remove trailing slashes for monetdb.program.path parameter for monetdb.server.setup (Thanks, Anthony!) - fixed monetdbd.liststatus (Thanks, Bart) diff --git a/clients/R/MonetDB.R/R/monetdb.R b/clients/R/MonetDB.R/R/monetdb.R --- a/clients/R/MonetDB.R/R/monetdb.R +++ b/clients/R/MonetDB.R/R/monetdb.R @@ -21,7 +21,7 @@ MonetR <- MonetDB <- MonetDBR <- MonetDB setMethod("dbGetInfo", "MonetDBDriver", def=function(dbObj, ...) list(name="MonetDBDriver", - driver.version="0.9.3", + driver.version="0.9.4", DBI.version="0.2-7", client.version=NA, max.connections=NA) @@ -168,17 +168,17 @@ if (is.null(getGeneric("dbTransaction")) standardGeneric("dbTransaction")) setMethod("dbTransaction", signature(conn="MonetDBConnection"), def=function(conn, ...) { - dbSendQuery(conn, "start transaction") + dbSendQuery(conn, "START TRANSACTION") invisible(TRUE) }) setMethod("dbCommit", "MonetDBConnection", def=function(conn, ...) { - dbSendQuery(conn, "commit") + dbSendQuery(conn, "COMMIT") invisible(TRUE) }) setMethod("dbRollback", "MonetDBConnection", def=function(conn, ...) { - dbSendQuery(conn, "rollback") + dbSendQuery(conn, "ROLLBACK") invisible(TRUE) }) @@ -275,9 +275,8 @@ setMethod("dbSendQuery", signature(conn= # adapted from RMonetDB, very useful... -setMethod("dbWriteTable", "MonetDBConnection", def=function(conn, name, value, overwrite=TRUE, +setMethod("dbWriteTable", "MonetDBConnection", def=function(conn, name, value, overwrite=FALSE, append=FALSE, insert=FALSE, ...) { - if (is.vector(value) && !is.list(value)) value <- data.frame(x=value) if (length(value)<1) stop("value must have at least one column") if (is.null(names(value))) names(value) <- paste("V", 1:length(value), sep='') @@ -286,32 +285,41 @@ setMethod("dbWriteTable", "MonetDBConnec } else { if (!is.data.frame(value)) value <- as.data.frame(value) } - fts <- sapply(value, dbDataType, dbObj=conn) - + if (overwrite && append) { + stop("Setting both overwrite and append to true makes no sense.") + } + qname <- make.db.names(conn, name, allow.keywords=FALSE) if (dbExistsTable(conn, name)) { if (overwrite) dbRemoveTable(conn, name) - else stop("Table `", name, "' already exists") + if (!overwrite && !append) stop("Table '", name, "' already exists. Set overwrite=TRUE if you want to remove + the existing table. Set append=TRUE if you would like to add the new data to the existing table.") } - - fdef <- paste(make.db.names(conn, names(value), allow.keywords=FALSE), fts, collapse=', ') - qname <- make.db.names(conn, name, allow.keywords=FALSE) - ct <- paste("CREATE TABLE ", qname, " (", fdef, ")", sep= '') - dbSendUpdate(conn, ct) - + if (!dbExistsTable(conn, name)) { + fts <- sapply(value, dbDataType, dbObj=conn) + fdef <- paste(make.db.names(conn, names(value), allow.keywords=FALSE), fts, collapse=', ') + ct <- paste("CREATE TABLE ", qname, " (", fdef, ")", sep= '') + dbSendUpdate(conn, ct) + } if (length(value[[1]])) { - inss <- paste("INSERT INTO ", qname, " VALUES(", paste(rep("?", length(value)), collapse=', '), + if (insert) { + inss <- paste("INSERT INTO ", qname, " VALUES (", paste(rep("?", length(value)), collapse=', '), ")", sep='') - .mapiRequest(conn, "Xauto_commit 0") - for (j in 1:length(value[[1]])) dbSendUpdate(conn, inss, list=as.list(value[j, ])) - dbSendQuery(conn, "COMMIT") - .mapiRequest(conn, "Xauto_commit 1") + dbTransaction(conn) + for (j in 1:length(value[[1]])) dbSendUpdate(conn, inss, list=as.list(value[j, ])) + dbCommit(conn) + } else { + tmp <- tempfile(fileext = ".csv") + write.table(value, tmp, sep = ",", quote = TRUE,row.names = FALSE, col.names = FALSE,na="") + dbSendQuery(conn, paste0("COPY ",format(nrow(value), scientific=FALSE)," RECORDS INTO ", qname, + " FROM '", tmp, "' USING DELIMITERS ',','\\n','\"' NULL AS '' LOCKED")) + file.remove(tmp) + } } return(invisible(TRUE)) }) setMethod("dbDataType", signature(dbObj="MonetDBConnection", obj = "ANY"), def = function(dbObj, obj, ...) { - if (is.logical(obj)) "BOOLEAN" else if (is.integer(obj)) "INTEGER" else if (is.numeric(obj)) "DOUBLE PRECISION" diff --git a/clients/R/MonetDB.R/man/dbTransaction.Rd b/clients/R/MonetDB.R/man/dbTransaction.Rd new file mode 100644 --- /dev/null +++ b/clients/R/MonetDB.R/man/dbTransaction.Rd @@ -0,0 +1,37 @@ +\name{dbTransaction} +\alias{dbTransaction} +\alias{dbTransaction,MonetDBConnection-method} +\alias{dbCommit,MonetDBConnection-method} +\alias{dbRollback,MonetDBConnection-method} + +\title{ + Create, commit or abort a database transaction. +} +\description{ +\code{dbTransaction} is used to switch the data from the normal auto-commiting mode into transactional mode. Here, changes to the database will not be permanent until \code{dbCommit} is called. If the changes are not to be kept around, you can use \code{dbRollback} to undo all the changes since \code{dbTransaction} was called. + +} +\usage{ + dbTransaction(conn, ...) +} +\arguments{ + \item{conn}{A MonetDB.R database connection. Created using \code{\link[DBI]{dbConnect}} + with the \code{\link[MonetDB.R]{MonetDB.R}} database driver.} + \item{...}{Future use.} + } +\value{ + Returns \code{TRUE} if the transaction command was successful. +} +\examples{ +\dontrun{ +conn <- dbConnect(MonetDB.R(), "monetdb://localhost/acs") +dbSendUpdate(conn, "CREATE TABLE foo(a INT,b VARCHAR(100))") +dbTransaction(conn) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list