Changeset: 512c007ceb80 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=512c007ceb80
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
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
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/Makefile.ag
gdk/gdk.h
java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/algebra.h
monetdb5/modules/kernel/algebra.mal
monetdb5/modules/mal/Makefile.ag
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/mal_init.mal
monetdb5/optimizer/opt_centipede.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_support.c
monetdb5/tests/gdkTests/Tests/All
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_gencode.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/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
Branch: multifarm
Log Message:
Merge with default branch.
diffs (truncated from 11838 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/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 =
"[email protected]"),
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)
+dbSendUpdate(conn, "INSERT INTO foo VALUES(?,?)", 42, "bar")
+dbCommit(conn)
+dbTransaction(conn)
+dbSendUpdate(conn, "INSERT INTO foo VALUES(?,?)", 43, "bar")
+dbRollback(conn)
+
+# only 42 will be in table foo
+}}
diff --git a/clients/R/MonetDB.R/man/monetdb_queryinfo.Rd
b/clients/R/MonetDB.R/man/monetdb_queryinfo.Rd
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/man/monetdb_queryinfo.Rd
@@ -0,0 +1,31 @@
+\name{monetdb_queryinfo}
+\alias{monetdb_queryinfo}
+
+\title{
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list