Commit 9cbd6719 authored by Andreas Tille's avatar Andreas Tille

New upstream version 0.6-2

parent daba4136
2017-06-19 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
* new libpq from postgresql-9.6.3 and Makefiles generated on Sierra (macOS 10.12)
2014-02-08 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Update tests docs for CRAN submission.
A bug in postgresqlNewConnection() was identified and fixed during the
test rewrite.
* inst/ANNOUNCEMENT
* inst/NEWS
* man/dbConnect-methods.Rd: explanation of the parameters.
* R/PostgreSQLSupport.R: newConnection do not emit error on NULL
argument but convert to empty string which is a valid value.
* src/RS-PostgreSQL.c: RS_PostgreSQL_newConnection() don't checkk for
empty string.
* tests: Write more appropriate comments. Tell when the test is
skipped.
2014-02-06 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
* config.sub, config.guess, install-sh move to src subdirectory
* man/postgresqlBuildTableDefinition.Rd: Shorten usage line
* man/postgresqlSupport.Rd: Shorten usage line
2014-02-04 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
* ChangeLog
* inst/News
* src/libpq: update to libpq from postgresql-9.3.2
* configure.in: change the condition to use accompanied libpq
* configure
* tests/bytea.R: test both standard_conforming_strings states; add PASS response
2014-01-30 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Support hex conversion for unescaping.
Prevent segfault on unknown type to dbWriteTable.
Add minimal description of the escapebytea and unescapebytea.
* ChangeLog
* man/postgresqlSupport.Rd
* src/RS-PQescape.c
* src/RS-pgsql-copy.c
* R/PostgreSQLSupport.R: separate message body from heading
* tests/bytea.R: remove E prefix for postgresql version 9, though this
cause warning on 8.X.
* DESCRIPTION: forward the version to 0.5-1
* R/PostgreSQL.R: forward the version to 0.5-1
2014-01-29 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Initial support for Bytea data type.
* ChangeLog
* src/RS-PQescape.c
* R/PostgreSQLSupport.R
* NAMESPACE
* tests/bytea.R
2013-11-12 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Prepare for release
* inst/NEWS
* man/postgresqlBuildTableDefinition.Rd: line length
* man/postgresqlSupport.Rd: line length
2013-10-27 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Strange path support for OS X 10.9 Marvericks
* configure.in
* configure
* src/RS-PostgreSQL.c: keep declaration on the top of a block.
2013-08-22 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Memory leak detected by valgrind.
* src/RS-PostgreSQL.c
* src/RS-pgsql-copy.c
* src/RS-pgsql-getResult.c
* src/RS-pgsql-pqexec.c
* src/RS-pgsql-pqexecparams.c
2013-06-21 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
* postgresqlWriteTable: send column names at COPY;
* dbWriteTableTest.R: test for append=T
2013-06-12 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Close the socket on failure of opening connection
* src/RS-PostgreSQL.c
2013-03-27 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp> 2013-03-27 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
Document synchronization and testoutputs. Document synchronization and testoutputs.
......
Package: RPostgreSQL Package: RPostgreSQL
Version: 0.4 Version: 0.6-2
Date: $Date: 2013-03-27 15:32:53 +0900 (Wed, 27 Mar 2013) $ Date: 2017-06-24
Title: R interface to the PostgreSQL database system Title: R Interface to the 'PostgreSQL' Database System
Author: Joe Conway, Dirk Eddelbuettel, Tomoaki Nishiyama, Sameer Kumar Author: Joe Conway, Dirk Eddelbuettel, Tomoaki Nishiyama, Sameer Kumar Prayaga (during 2008), Neil Tiffin
Prayaga (during 2008), Neil Tiffin
Maintainer: Tomoaki Nishiyama <tomoakin@staff.kanazawa-u.ac.jp> Maintainer: Tomoaki Nishiyama <tomoakin@staff.kanazawa-u.ac.jp>
Description: Database interface and PostgreSQL driver for R This Description: Database interface and 'PostgreSQL' driver for 'R'.
package provides a Database Interface (DBI) compliant driver This package provides a Database Interface 'DBI' compliant
for R to access PostgreSQL database systems. driver for 'R' to access 'PostgreSQL' database systems.
. In order to build and install this package from source, 'PostgreSQL'
In order to build and install this package from source, PostgreSQL itself must be present your system to provide 'PostgreSQL' functionality
itself must be present your system to provide PostgreSQL via its libraries and header files. These files are provided as
functionality via its libraries and header files. These files 'postgresql-devel' package under some Linux distributions.
are provided as postgresql-devel package under some Linux On 'macOS' and 'Microsoft Windows' system the attached 'libpq' library source will be used.
distributions.
.
On Microsoft Windows system the attached libpq library source will be
used.
.
A wiki and issue tracking system for the package are available at
Google Code at https://code.google.com/p/rpostgresql/ .
LazyLoad: true LazyLoad: true
Depends: R (>= 2.9.0), methods, DBI (>= 0.1-4) Depends: R (>= 2.9.0), methods, DBI (>= 0.3)
License: GPL-2 | file LICENSE License: GPL-2 | file LICENSE
Copyright: Authors listed above, PostgreSQL Global Development Group, Copyright: Authors listed above, PostgreSQL Global Development Group,
and The Regents of the University of California and The Regents of the University of California
Collate: S4R.R zzz.R PostgreSQLSupport.R dbObjectId.R PostgreSQL.R Collate: S4R.R zzz.R PostgreSQLSupport.R dbObjectId.R PostgreSQL.R
URL: https://code.google.com/p/rpostgresql/, URL: https://github.com/tomoakin/RPostgreSQL,
http://www.stat.bell-labs.com/RS-DBI, http://www.postgresql.org https://cran.r-project.org/package=DBI,
Packaged: 2013-03-27 07:24:02 UTC; tomoaki http://www.postgresql.org
NeedsCompilation: yes NeedsCompilation: yes
Packaged: 2017-06-24 03:16:20 UTC; tomoaki
Repository: CRAN Repository: CRAN
Date/Publication: 2013-03-27 09:34:11 Date/Publication: 2017-06-24 07:17:52 UTC
This diff is collapsed.
import(methods) import(methods)
import(DBI) import(DBI)
importFrom("utils", "count.fields", "read.table")
useDynLib(RPostgreSQL) useDynLib(RPostgreSQL, .registration = TRUE)
## Classes ## Classes
exportClasses( exportClasses(
...@@ -17,6 +18,7 @@ exportClasses( ...@@ -17,6 +18,7 @@ exportClasses(
exportMethods( exportMethods(
coerce, coerce,
dbApply, dbApply,
dbBegin,
dbCallProc, dbCallProc,
dbClearResult, dbClearResult,
dbColumnInfo, dbColumnInfo,
...@@ -86,6 +88,8 @@ export( ...@@ -86,6 +88,8 @@ export(
postgresqlReadTable, postgresqlReadTable,
postgresqlWriteTable, postgresqlWriteTable,
postgresqlEscapeStrings, postgresqlEscapeStrings,
postgresqlEscapeBytea,
postgresqlUnescapeBytea,
postgresqlDataType, postgresqlDataType,
postgresqlQuoteId, postgresqlQuoteId,
postgresqlTableRef postgresqlTableRef
......
## PostgreSQL.R ## PostgreSQL.R
## $Id: PostgreSQL.R 223 2011-12-29 11:31:45Z tomoakin@kenroku.kanazawa-u.ac.jp $ ## $Id$
## This package was developed as a part of Summer of Code program organized by Google. ## This package was developed as a part of Summer of Code program organized by Google.
## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package. ## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
##.PostgreSQLRCS <- "$Id: PostgreSQL.R,v 0.1 2008/06/10 14:00:00$" ##.PostgreSQLRCS <- "$Id: PostgreSQL.R,v 0.1 2008/06/10 14:00:00$"
.PostgreSQLPkgName <- "RPostgreSQL" .PostgreSQLPkgName <- "RPostgreSQL"
.PostgreSQLVersion <- "0.3-0" ##package.description(.PostgreSQLPkgName, fields = "Version") .PostgreSQLVersion <- "0.6-1" ##package.description(.PostgreSQLPkgName, fields = "Version")
.PostgreSQL.NA.string <- "\\N" ## on input, PostgreSQL interprets \N as NULL (NA) .PostgreSQL.NA.string <- "\\N" ## on input, PostgreSQL interprets \N as NULL (NA)
setOldClass("data.frame") ## to appease setMethod's signature warnings... setOldClass("data.frame") ## to appease setMethod's signature warnings...
...@@ -107,8 +107,7 @@ setMethod("dbGetException", "PostgreSQLConnection", ...@@ -107,8 +107,7 @@ setMethod("dbGetException", "PostgreSQLConnection",
def = function(conn, ...){ def = function(conn, ...){
if(!isPostgresqlIdCurrent(conn)) if(!isPostgresqlIdCurrent(conn))
stop(paste("expired", class(conn))) stop(paste("expired", class(conn)))
.Call("RS_PostgreSQL_getException", as(conn, "integer"), .Call(RS_PostgreSQL_getException, as(conn, "integer"))
PACKAGE = .PostgreSQLPkgName)
}, },
valueClass = "list" valueClass = "list"
) )
...@@ -200,6 +199,31 @@ setMethod("dbRemoveTable", ...@@ -200,6 +199,31 @@ setMethod("dbRemoveTable",
valueClass = "logical" valueClass = "logical"
) )
setMethod("dbBegin",
signature(conn="PostgreSQLConnection"),
def = function(conn, ...){
rc <- try(dbGetQuery(conn, "BEGIN"))
!inherits(rc, ErrorClass)
},
valueClass = "logical"
)
setMethod("dbCommit",
signature(conn="PostgreSQLConnection"),
def = function(conn, ...){
rc <- try(dbGetQuery(conn, "COMMIT"))
!inherits(rc, ErrorClass)
},
valueClass = "logical"
)
setMethod("dbRollback",
signature(conn="PostgreSQLConnection"),
def = function(conn, ...){
rc <- try(dbGetQuery(conn, "ROLLBACK"))
!inherits(rc, ErrorClass)
},
valueClass = "logical"
)
## return field names (no metadata) ## return field names (no metadata)
setMethod("dbListFields", setMethod("dbListFields",
signature(conn="PostgreSQLConnection", name="character"), signature(conn="PostgreSQLConnection", name="character"),
...@@ -337,7 +361,7 @@ setMethod("dbHasCompleted", "PostgreSQLResult", ...@@ -337,7 +361,7 @@ setMethod("dbHasCompleted", "PostgreSQLResult",
setMethod("dbGetException", "PostgreSQLResult", setMethod("dbGetException", "PostgreSQLResult",
def = function(conn, ...){ def = function(conn, ...){
id <- as(conn, "integer")[1:2] id <- as(conn, "integer")[1:2]
.Call("RS_PostgreSQL_getException", id, PACKAGE = .PostgreSQLPkgName) .Call(RS_PostgreSQL_getException, id)
}, },
valueClass = "list" ## TODO: should be a DBIException? valueClass = "list" ## TODO: should be a DBIException?
) )
......
This diff is collapsed.
## R/S-Plus compatibility ## R/S-Plus compatibility
## $Id: S4R.R 189 2011-10-01 13:16:39Z dirk.eddelbuettel $ ## $Id$
## This package was developed as a part of Summer of Code program organized by Google. ## This package was developed as a part of Summer of Code program organized by Google.
## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package. ## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package.
......
## Class: dbObjectId ## Class: dbObjectId
## $Id: dbObjectId.R 220 2011-12-03 12:50:46Z tomoakin@kenroku.kanazawa-u.ac.jp $ ## $Id$
## This package was developed as a part of Summer of Code program organized by Google. ## This package was developed as a part of Summer of Code program organized by Google.
## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package. ## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package.
...@@ -52,7 +52,7 @@ setMethod("print", "dbObjectId", ...@@ -52,7 +52,7 @@ setMethod("print", "dbObjectId",
## verify that obj refers to a currently open/loaded database ## verify that obj refers to a currently open/loaded database
isPostgresqlIdCurrent <- function(obj) { isPostgresqlIdCurrent <- function(obj) {
obj <- as(obj, "integer") obj <- as(obj, "integer")
.Call("RS_DBI_validHandle", obj, PACKAGE = .PostgreSQLPkgName) .Call(RS_DBI_validHandle, obj)
} }
## zzz.R ## zzz.R
## $Id: zzz.R 189 2011-10-01 13:16:39Z dirk.eddelbuettel $ ## $Id$
## This package was developed as a part of Summer of Code program organized by Google. ## This package was developed as a part of Summer of Code program organized by Google.
## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package. ## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
# This file draws heavily on configure.in files from littler, RMySQL, and RdbiPgSQL # This file draws heavily on configure.in files from littler, RMySQL, and RdbiPgSQL
# Set the name and version -- the version set here will propagate to other files from here # Set the name and version -- the version set here will propagate to other files from here
AC_INIT(RPostgreSQL, 0.2) AC_INIT(RPostgreSQL, 0.5)
AC_CONFIG_AUX_DIR(src)
# Checks for common programs using default macros # Checks for common programs using default macros
AC_PROG_CC AC_PROG_CC
...@@ -36,12 +38,12 @@ if test "${PG_CONFIG}" != ""; then ...@@ -36,12 +38,12 @@ if test "${PG_CONFIG}" != ""; then
else else
# let's look around -- code copied from RdbuiPgSQL but modified to use test -f # let's look around -- code copied from RdbuiPgSQL but modified to use test -f
# added fink standard install location Neil 8/30/2009
AC_MSG_NOTICE([checking for PostgreSQL header files]) AC_MSG_NOTICE([checking for PostgreSQL header files])
if ! test $PG_INCDIR if ! test $PG_INCDIR
then then
for dir in \ for dir in \
/usr/include \ /usr/include \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include \
/usr/include/pgsql \ /usr/include/pgsql \
/usr/include/postgresql \ /usr/include/postgresql \
/usr/local/include \ /usr/local/include \
...@@ -54,9 +56,6 @@ else ...@@ -54,9 +56,6 @@ else
/opt/include/postgresql \ /opt/include/postgresql \
/opt/local/include \ /opt/local/include \
/opt/local/include/postgresql \ /opt/local/include/postgresql \
/opt/local/include/postgresql84 \
/sw/opt/postgresql-8.4/include \
/Library/PostgresPlus/8.4SS/include \
/sw/include/postgresql /sw/include/postgresql
do do
AC_MSG_NOTICE([Checking include ${dir}.]) AC_MSG_NOTICE([Checking include ${dir}.])
...@@ -67,7 +66,7 @@ else ...@@ -67,7 +66,7 @@ else
fi fi
done done
fi fi
# likewise, let's look around for libpq.so # likewise, let's look around for libpq.so
if ! test $PG_LIBDIR if ! test $PG_LIBDIR
then then
...@@ -85,9 +84,6 @@ else ...@@ -85,9 +84,6 @@ else
/opt/lib/postgresql \ /opt/lib/postgresql \
/opt/local/lib \ /opt/local/lib \
/opt/local/lib/postgresql \ /opt/local/lib/postgresql \
/opt/local/lib/postgresql84 \
/sw/opt/postgresql-8.4/lib \
/Library/PostgresPlus/8.4SS/lib \
/sw/lib /sw/lib
do do
AC_MSG_NOTICE([Checking lib ${dir}.]) AC_MSG_NOTICE([Checking lib ${dir}.])
...@@ -103,8 +99,11 @@ else ...@@ -103,8 +99,11 @@ else
fi fi
done done
fi fi
if ! test $PG_LIBDIR if test $PG_LIBDIR && test $PG_INCDIR
then then
echo $PG_LIBDIR
echo $PG_INCDIR
else
if test "$R_OS_TYPE" = "darwin" ; then if test "$R_OS_TYPE" = "darwin" ; then
# in case we cannot find any libpq library we will use the accompanied libpq # in case we cannot find any libpq library we will use the accompanied libpq
# This content would be written into src/Makevars at the end of this script # This content would be written into src/Makevars at the end of this script
...@@ -118,7 +117,7 @@ all: $(SHLIB) ...@@ -118,7 +117,7 @@ all: $(SHLIB)
$(SHLIB): libpq/libpq.5.dylib $(SHLIB): libpq/libpq.5.dylib
libpq/libpq.5.dylib: libpq/libpq.5.dylib:
(cd libpq; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" -f Makefile.darwin) (cd libpq; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" -f Makefile.darwin pg_config.h pg_config_os.h all)
clean: clean:
(cd libpq; $(MAKE) -f Makefile.darwin clean) (cd libpq; $(MAKE) -f Makefile.darwin clean)
...@@ -128,8 +127,16 @@ clean: ...@@ -128,8 +127,16 @@ clean:
fi fi
# Expand into arguments # Expand into arguments
# make sure we use the included libpq-fe.h if it was not previously found
if ! test $PG_INCDIR ; then
AC_MSG_NOTICE([Using internal package libpq-fe.h])
PG_INCDIR="src/libpq"
fi
PKG_CPPFLAGS="-I${PG_INCDIR}" PKG_CPPFLAGS="-I${PG_INCDIR}"
PKG_LIBS="-L${PG_LIBDIR} -lpq" PKG_LIBS="-L${PG_LIBDIR} -lpq"
# Test for sanity by looking for libpq-fe.h, no explicit action on found, error on failure # Test for sanity by looking for libpq-fe.h, no explicit action on found, error on failure
AC_CHECK_FILE(["${PG_INCDIR}/libpq-fe.h"], AC_CHECK_FILE(["${PG_INCDIR}/libpq-fe.h"],
, ,
......
RPostgreSQL version 0.4 RPostgreSQL version 0.5
We are pround to announce the availability of the RPostgreSQL package on CRAN We are pround to announce the availability of the RPostgreSQL package on CRAN
and its mirrors. This package provides an a DBI-compliant interface between and its mirrors. This package provides an a DBI-compliant interface between
...@@ -10,7 +10,7 @@ by Sameer Kumar Prayaga <sameer.bits@gmail.com>. ...@@ -10,7 +10,7 @@ by Sameer Kumar Prayaga <sameer.bits@gmail.com>.
Some highlights: Some highlights:
o Initial support for prepared statement. o Binary data store in PostgreSQL bytea datatype.
Known bugs/deficiencies: Known bugs/deficiencies:
...@@ -18,13 +18,7 @@ Known bugs/deficiencies: ...@@ -18,13 +18,7 @@ Known bugs/deficiencies:
o Active issue list is at http://code.google.com/p/rpostgresql/issues/list o Active issue list is at http://code.google.com/p/rpostgresql/issues/list
RPostgreSQL is hosted on Google Code, for more information see RPostgreSQL is hosted on Github https://github.com/tomoakin/RPostgreSQL
http://rpostgresql.googlecode.com/
For any suggestions and queries, please contact:
rpostgresql-dev@googlegroups.com
For security issues that should not directly go to public, For security issues that should not directly go to public,
you may contact: you may contact:
......
Version 0.6-2
o dbGetQuery do not return NULL.
o use registration mechanism to call native routines.
Version 0.5-3
o Update the libpq library so that the package can be compiled in new versions of R and macOS.
Version 0.5-2
o Support dbBegin() API
version 0.5-1 --2014-02-08
o Remove segmentationfault when NULL is passed as host argument.
o Conversion routine for raw in R and bytea in PostgreSQL
o Use accompanied libpq when either of libpq and header is not found on darwin
Version 0.5 -- 2013-10-12
o postgresqlWriteTable: send column names at COPY
o System library header search path for OS X 10.9 (Mavericks)
o Memory leak was reduced
o Close the socket on failure
Version 0.4 -- 2013-03-27 Version 0.4 -- 2013-03-27
o Initial implementation of prepared statement o Initial implementation of prepared statement
......
...@@ -16,3 +16,4 @@ Things yet to be completed: ...@@ -16,3 +16,4 @@ Things yet to be completed:
5. Check the working of DBI extension "dbApply". 5. Check the working of DBI extension "dbApply".
6. Binary data transfer to store IEEE754 floating point data without loss of precision.
...@@ -63,7 +63,7 @@ The most important parameters are \code{user}, \code{password}, ...@@ -63,7 +63,7 @@ The most important parameters are \code{user}, \code{password},
} }
\author{David A. James} \author{David A. James}
\section{References}{ \section{References}{
See \url{stat.bell-labs.com/RS-DBI} See \url{https://cran.r-project.org/package=DBI}
for more details on the R/S-Plus database interface. for more details on the R/S-Plus database interface.
See the documentation at the PostgreSQL Web site See the documentation at the PostgreSQL Web site
......
...@@ -16,6 +16,7 @@ Class \code{"dbObjectId"}, by class "PostgreSQLObject". ...@@ -16,6 +16,7 @@ Class \code{"dbObjectId"}, by class "PostgreSQLObject".
\section{Methods}{ \section{Methods}{
\describe{ \describe{
\item{\link{coerce}}{\code{signature(from = "PostgreSQLConnection", to = "PostgreSQLResult")}: ... } \item{\link{coerce}}{\code{signature(from = "PostgreSQLConnection", to = "PostgreSQLResult")}: ... }
\item{\link[DBI]{dbBegin}}{\code{signature(conn = "PostgreSQLConnection")}: ... }
\item{\link[DBI]{dbCallProc}}{\code{signature(conn = "PostgreSQLConnection")}: ... } \item{\link[DBI]{dbCallProc}}{\code{signature(conn = "PostgreSQLConnection")}: ... }
\item{\link[DBI]{dbCommit}}{\code{signature(conn = "PostgreSQLConnection")}: ... } \item{\link[DBI]{dbCommit}}{\code{signature(conn = "PostgreSQLConnection")}: ... }
\item{\link[DBI]{dbConnect}}{\code{signature(drv = "PostgreSQLConnection")}: ... } \item{\link[DBI]{dbConnect}}{\code{signature(drv = "PostgreSQLConnection")}: ... }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
See the Database Interface definition document See the Database Interface definition document
\code{DBI.pdf} in the base directory of this package \code{DBI.pdf} in the base directory of this package
or or
\url{http://stat.bell-labs.com/RS-DBI}. \url{https://cran.r-project.org/package=DBI}.
} }
\seealso{ \seealso{
\code{\link{PostgreSQL}} \code{\link{PostgreSQL}}
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
\references{ \references{
See the Database Interface definition document See the Database Interface definition document
\code{DBI.pdf} in the base directory of this package \code{DBI.pdf} in the base directory of this package
or \url{http://stat.bell-labs.com/RS-DBI}. or \url{https://cran.r-project.org/package=DBI}.
} }
\seealso{ \seealso{
\code{\link{PostgreSQL}}, \code{\link{PostgreSQL}},
......
% $Id: dbCommit-methods.Rd,v 0.1 2008/08/10 18:04:01 psk Exp $ % $Id: dbCommit-methods.Rd,v 0.1 2008/08/10 18:04:01 psk Exp $
\name{dbCommit-methods} \name{dbCommit-methods}
\docType{methods} \docType{methods}
\alias{dbCommit-methods} \alias{dbBegin-method}
\alias{dbRollback-methods} \alias{dbCommit-method}
\alias{dbRollback-method}
\alias{PostgreSQLConnection-method} \alias{PostgreSQLConnection-method}
\alias{dbBegin,PostgreSQLConnection-method}
\alias{dbCommit,PostgreSQLConnection-method} \alias{dbCommit,PostgreSQLConnection-method}
\alias{dbRollback,PostgreSQLConnection-method} \alias{dbRollback,PostgreSQLConnection-method}
\title{ \title{
DBMS Transaction Management DBMS Transaction Management
} }
\description{ \description{
Commits or roll backs the current transaction Transaction related commands.
Start a transaction, commit or roll back the current transaction
in an PostgreSQL connection. in an PostgreSQL connection.
\code{dbBegin} starts a transaction.
\code{dbCommit} and \code{dbRollback} commit and rollback the \code{dbCommit} and \code{dbRollback} commit and rollback the
transaction, respectively. transaction, respectively.
...@@ -26,10 +30,11 @@ ...@@ -26,10 +30,11 @@
See the Database Interface definition document See the Database Interface definition document
\code{DBI.pdf} in the base directory of this package \code{DBI.pdf} in the base directory of this package
or or
\url{http://stat.bell-labs.com/RS-DBI}. \url{https://cran.r-project.org/package=DBI}.
} }
\seealso{ \seealso{
\code{\link{PostgreSQL}}, \code{\link{PostgreSQL}},
\code{\link[DBI]{dbBegin}},
\code{\link[DBI]{dbConnect}}, \code{\link[DBI]{dbConnect}},
\code{\link[DBI]{dbSendQuery}}, \code{\link[DBI]{dbSendQuery}},
\code{\link[DBI]{dbGetQuery}}, \code{\link[DBI]{dbGetQuery}},
...@@ -43,7 +48,7 @@ drv <- dbDriver("PostgreSQL") ...@@ -43,7 +48,7 @@ drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname="postgres") con <- dbConnect(drv, dbname="postgres")
dbGetQuery(con, "select count(*) from sales") dbGetQuery(con, "select count(*) from sales")
dbGetQuery(con, "BEGIN TRANSACTION") dbBegin(con)
rs <- dbSendQuery(con, rs <- dbSendQuery(con,
"Delete * from sales as p where p.cost>10") "Delete * from sales as p where p.cost>10")
if(dbGetInfo(rs, what = "rowsAffected") > 250){ if(dbGetInfo(rs, what = "rowsAffected") > 250){
......
...@@ -22,19 +22,19 @@ ...@@ -22,19 +22,19 @@
\item{conn}{ \item{conn}{
an \code{PostgreSQLConnection} object as produced by \code{dbConnect}. an \code{PostgreSQLConnection} object as produced by \code{dbConnect}.
} }
\item{host}{Name or the numeric IPaddress of the host to connect to. If address is specified, it should be in the standard IPv4 address format, e.g., 172.28.40.9 or if your machine supports IPv6, you can also use those addresses. The default is to connect to localhost. \item{host}{Name or the numeric IPaddress of the host to connect to. If address is specified, it should be in the standard IPv4 address format, e.g., 172.28.40.9 or if your machine supports IPv6, you can also use those addresses. The default is to connect to localhost by a UNIX domain socket.
} }
\item{dbname}{The database name. Defaults to 'template1' i.e if this argument is not specified, it is taken as dbname="template1". \item{dbname}{The database name. Defaults to "", which is interpreted as PostgreSQL default.
} }
\item{user}{PostgreSQL user name to connect as. Defaults to be the same as the operating system name of the user running the application. \item{user}{PostgreSQL user name to connect as. Defaults to be the same as the operating system name of the user running the application.
}