Revision: 269
Author:
tomo...@kenroku.kanazawa-u.ac.jp
Date: Sat Feb 8 09:29:04 2014 UTC
Log: Bugfix in postgresqlNewConnection() and tests/docs updates
http://code.google.com/p/rpostgresql/source/detail?r=269
Added:
/trunk/build_check_with_vars.sh
Modified:
/trunk/RPostgreSQL/ChangeLog
/trunk/RPostgreSQL/R/PostgreSQLSupport.R
/trunk/RPostgreSQL/inst/ANNOUNCEMENT
/trunk/RPostgreSQL/inst/NEWS
/trunk/RPostgreSQL/man/dbConnect-methods.Rd
/trunk/RPostgreSQL/src/RS-PostgreSQL.c
/trunk/RPostgreSQL/tests/bytea.R
/trunk/RPostgreSQL/tests/bytea.Rout.save
/trunk/RPostgreSQL/tests/connectWithNull.R
/trunk/RPostgreSQL/tests/connectWithNull.Rout.save
/trunk/RPostgreSQL/tests/createTableMixedCaseTest.R
/trunk/RPostgreSQL/tests/createTableMixedCaseTest.Rout.save
/trunk/RPostgreSQL/tests/dataTypeTests.R
/trunk/RPostgreSQL/tests/dataTypeTests.Rout.save
/trunk/RPostgreSQL/tests/dateTZ.R
/trunk/RPostgreSQL/tests/dateTZ.Rout.save
/trunk/RPostgreSQL/tests/datetimeTests.R
/trunk/RPostgreSQL/tests/datetimeTests.Rout.save
/trunk/RPostgreSQL/tests/datetimestampwrite.R
/trunk/RPostgreSQL/tests/datetimestampwrite.Rout.save
/trunk/RPostgreSQL/tests/dbColumnInfo.R
/trunk/RPostgreSQL/tests/dbColumnInfo.Rout.save
/trunk/RPostgreSQL/tests/dbExistsIssue.R
/trunk/RPostgreSQL/tests/dbExistsIssue.Rout.save
/trunk/RPostgreSQL/tests/dbExistsq.R
/trunk/RPostgreSQL/tests/dbExistsq.Rout.save
/trunk/RPostgreSQL/tests/dbExistsqc.R
/trunk/RPostgreSQL/tests/dbExistsqc.Rout.save
/trunk/RPostgreSQL/tests/dbGetQueryParams.R
/trunk/RPostgreSQL/tests/dbGetQueryParams.Rout.save
/trunk/RPostgreSQL/tests/dbListFields.R
/trunk/RPostgreSQL/tests/dbListFields.Rout.save
/trunk/RPostgreSQL/tests/dbTransactionTests.R
/trunk/RPostgreSQL/tests/dbTransactionTests.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTableFailTest.R
/trunk/RPostgreSQL/tests/dbWriteTableFailTest.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTableSchema.R
/trunk/RPostgreSQL/tests/dbWriteTableSchema.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTableTest.R
/trunk/RPostgreSQL/tests/dbWriteTableTest.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTabletypes.R
/trunk/RPostgreSQL/tests/dbWriteTabletypes.Rout.save
/trunk/RPostgreSQL/tests/dbtemptable.R
/trunk/RPostgreSQL/tests/dbtemptable.Rout.save
/trunk/RPostgreSQL/tests/escape.R
/trunk/RPostgreSQL/tests/escape.Rout.save
/trunk/RPostgreSQL/tests/loadDriverAndConnect.R
/trunk/RPostgreSQL/tests/loadDriverAndConnect.Rout.save
/trunk/RPostgreSQL/tests/openSendQuery.R
/trunk/RPostgreSQL/tests/openSendQuery.Rout.save
/trunk/RPostgreSQL/tests/selectWhereZero.R
/trunk/RPostgreSQL/tests/selectWhereZero.Rout.save
/trunk/RPostgreSQL/tests/selectWithAlias.R
/trunk/RPostgreSQL/tests/selectWithAlias.Rout.save
/trunk/RPostgreSQL/tests/unknowntype.R
/trunk/RPostgreSQL/tests/unknowntype.Rout.save
=======================================
--- /dev/null
+++ /trunk/build_check_with_vars.sh Sat Feb 8 09:29:04 2014 UTC
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+## either define the variables here (and get a diff to SVN)
+##
+## export POSTGRES_USER="someuser"
+## export POSTGRES_PASSWD="..."
+## export POSTGRES_HOST="somehost"
+## export POSTGRES_DATABASE="testing124"
+## export POSTGRES_PORT="5432"
+##
+## or write them to a local file that can get sourced here
+##
+if [ -f ~/.RPostgreSQL_Test_Vars ]
+then
+ . ~/.RPostgreSQL_Test_Vars
+fi
+
+echo " "
+echo "-------------- write version info ----------------------"
+
+if [ -x /usr/bin/sw_vers ]
+then
+ sw_vers
+elif [ -x /usr/bin/lsb_release ]
+then
+ lsb_release -a
+fi
+echo ""
+svn_version=$(svnversion -n)
+echo "RPostgreSQL svn version: $svn_version"
+echo ""
+psql --version | head -n 1
+echo ""
+Rscript -e 'sessionInfo(); capabilities()' | sed -n -e '1,2p'
+echo ""
+Rscript -e 'packageDescription("RPostgreSQL", fields =
c("Package", "Version", "Packaged", "Built"))' | sed -n -e '1,4p'
+
+R CMD build RPostgreSQL
+R CMD check --as-cran RPostgreSQL_*.tar.gz
+
+echo "Done"
+exit 0
=======================================
--- /trunk/RPostgreSQL/ChangeLog Tue Feb 4 14:45:47 2014 UTC
+++ /trunk/RPostgreSQL/ChangeLog Sat Feb 8 09:29:04 2014 UTC
@@ -1,3 +1,25 @@
+2014-02-08 Tomoaki NISHIYAMA <
tomo...@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 <
tomo...@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 <
tomo...@staff.kanazawa-u.ac.jp>
* ChangeLog
@@ -5,7 +27,7 @@
* src/libpq: update to libpq from postgresql-9.3.2
*
configure.in: change the condition to use accompanied libpq
* configure
- * test/bytea.R: test both standard_conforming_strings states; add PASS
response
+ * tests/bytea.R: test both standard_conforming_strings states; add PASS
response
2014-01-30 Tomoaki NISHIYAMA <
tomo...@staff.kanazawa-u.ac.jp>
=======================================
--- /trunk/RPostgreSQL/R/PostgreSQLSupport.R Thu Jan 30 08:58:53 2014 UTC
+++ /trunk/RPostgreSQL/R/PostgreSQLSupport.R Sat Feb 8 09:29:04 2014 UTC
@@ -72,25 +72,27 @@
info
}
-## note that dbname may be a database name, an empty string "", or NULL.
-## The distinction between "" and NULL is that "" is interpreted by
-## the PostgreSQL API as the default database (PostgreSQL config specific)
-## while NULL means "no database".
+## All NULL values are changed to empty strings ("").
+## These are treated as default values.
postgresqlNewConnection <- function(drv, user = "", password = "",
host = "", dbname = "",
port = "", tty = "", options = "",
forceISOdate=TRUE) {
if(!isPostgresqlIdCurrent(drv))
stop("expired manager")
if(is.null(user))
- stop("user argument cannot be NULL")
+ user=""
if(is.null(password))
- stop("password argument cannot be NULL")
+ password=""
+ if(is.null(host))
+ host=""
if(is.null(dbname))
- stop("dbname argument cannot be NULL")
+ dbname=""
if(is.null(port))
- stop("port argument cannot be NULL")
+ port=""
if(is.null(tty))
- stop("tty argument cannot be NULL")
+ tty=""
+ if(is.null(options))
+ options=""
con.params <- as.character(c(user, password, host,
dbname, port,
=======================================
--- /trunk/RPostgreSQL/inst/ANNOUNCEMENT Wed Mar 27 06:32:53 2013 UTC
+++ /trunk/RPostgreSQL/inst/ANNOUNCEMENT Sat Feb 8 09:29:04 2014 UTC
@@ -1,5 +1,5 @@
- RPostgreSQL version 0.4
+ RPostgreSQL version 0.5
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
@@ -10,7 +10,7 @@
Some highlights:
- o Initial support for prepared statement.
+ o Binary data store in PostgreSQL bytea datatype.
Known bugs/deficiencies:
=======================================
--- /trunk/RPostgreSQL/inst/NEWS Tue Feb 4 14:45:47 2014 UTC
+++ /trunk/RPostgreSQL/inst/NEWS Sat Feb 8 09:29:04 2014 UTC
@@ -1,4 +1,6 @@
-version 0.5-1 --2014-02-04
+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
=======================================
--- /trunk/RPostgreSQL/man/dbConnect-methods.Rd Wed Dec 19 13:01:58 2012 UTC
+++ /trunk/RPostgreSQL/man/dbConnect-methods.Rd Sat Feb 8 09:29:04 2014 UTC
@@ -22,19 +22,19 @@
\item{conn}{
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{password}{Password to be used if the server demands password
authentication.
}
-\item{port}{Port number to connect to at the server host, or socket file
name extension for Unix-domain connections.
+\item{port}{Port number to connect to at the server host.
}
\item{tty}{Ignored (formerly, this specified where to send server debug
output).
}
-\item{options}{Command-line options to be sent to the server
+\item{options}{Command-line options to be sent to the server.
}
\item{forceISOdate}{logical if the communication of date (time stamp) from
PostgreSQL is forced to ISO style at conection.
}
=======================================
--- /trunk/RPostgreSQL/src/RS-PostgreSQL.c Sun Oct 27 11:52:56 2013 UTC
+++ /trunk/RPostgreSQL/src/RS-PostgreSQL.c Sat Feb 8 09:29:04 2014 UTC
@@ -205,35 +205,19 @@
Con_Handle *conHandle;
PGconn *my_connection;
- char *user = NULL, *password = NULL, *host = NULL, *dbname = NULL,
*port = NULL, *tty = NULL, *options = NULL;
+ const char *user = NULL, *password = NULL, *host = NULL, *dbname =
NULL, *port = NULL, *tty = NULL, *options = NULL;
if (!is_validHandle(mgrHandle, MGR_HANDLE_TYPE)) {
RS_DBI_errorMessage("invalid PostgreSQLManager", RS_DBI_ERROR);
}
-#define IS_EMPTY(s1) !strcmp((s1), "")
-
- if (!IS_EMPTY(CHR_EL(con_params, 0))) {
- user = (char *) CHR_EL(con_params, 0);
- }
- if (!IS_EMPTY(CHR_EL(con_params, 1))) {
- password = (char *) CHR_EL(con_params, 1);
- }
- if (!IS_EMPTY(CHR_EL(con_params, 2))) {
- host = (char *) CHR_EL(con_params, 2);
- }
- if (!IS_EMPTY(CHR_EL(con_params, 3))) {
- dbname = (char *) CHR_EL(con_params, 3);
- }
- if (!IS_EMPTY(CHR_EL(con_params, 4))) {
- port = (char *) CHR_EL(con_params, 4);
- }
- if (!IS_EMPTY(CHR_EL(con_params, 5))) {
- tty = (char *) CHR_EL(con_params, 5);
- }
- if (!IS_EMPTY(CHR_EL(con_params, 6))) {
- options = (char *) CHR_EL(con_params, 6);
- }
+ user = CHR_EL(con_params, 0);
+ password = CHR_EL(con_params, 1);
+ host = CHR_EL(con_params, 2);
+ dbname = CHR_EL(con_params, 3);
+ port = CHR_EL(con_params, 4);
+ tty = CHR_EL(con_params, 5);
+ options = CHR_EL(con_params, 6);
my_connection = PQsetdbLogin(host, port, options, tty, dbname, user,
password);
=======================================
--- /trunk/RPostgreSQL/tests/bytea.R Tue Feb 4 14:45:47 2014 UTC
+++ /trunk/RPostgreSQL/tests/bytea.R Sat Feb 8 09:29:04 2014 UTC
@@ -28,6 +28,8 @@
## Test the store/recovery of binary data
dbGetQuery(con, "CREATE TABLE byteatable (name text, val bytea)")
dbGetQuery(con, "set standard_conforming_strings to 'on'")
+ cat("Note the encoded string could differ depending on the server.\n")
+ cat("Show encoded string when standard_conforming_strings is on.\n")
print(postgresqlEscapeBytea(con, ser))
iq <- sprintf("INSERT INTO byteatable values('%s', '%s');", "name1",
postgresqlEscapeBytea(con, ser))
dbGetQuery(con, iq)
@@ -42,6 +44,7 @@
}
dbGetQuery(con, "set standard_conforming_strings to 'off'")
dbGetQuery(con, "set escape_string_warning to 'off'")
+ cat("Show encoded string when standard_conforming_strings is off.\n")
print(postgresqlEscapeBytea(con, ser))
iq <- sprintf("INSERT INTO byteatable values('%s', '%s');", "name2",
postgresqlEscapeBytea(con, ser))
dbGetQuery(con, iq)
@@ -58,4 +61,6 @@
dbDisconnect(con)
dbUnloadDriver(drv)
cat("DONE\n")
+}else{
+ cat("Skip because envirinmental variables are not set to tell the
connection params.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/bytea.Rout.save Tue Feb 4 14:45:47 2014 UTC
+++ /trunk/RPostgreSQL/tests/bytea.Rout.save Sat Feb 8 09:29:04 2014 UTC
@@ -45,6 +45,8 @@
+ ## Test the store/recovery of binary data
+ dbGetQuery(con, "CREATE TABLE byteatable (name text, val bytea)")
+ dbGetQuery(con, "set standard_conforming_strings to 'on'")
++ cat("Note the encoded string could differ depending on the
server.\n")
++ cat("Show encoded string when standard_conforming_strings is on.\n")
+ print(postgresqlEscapeBytea(con, ser))
+ iq <- sprintf("INSERT INTO byteatable values('%s', '%s');", "name1",
postgresqlEscapeBytea(con, ser))
+ dbGetQuery(con, iq)
@@ -59,6 +61,7 @@
+ }
+ dbGetQuery(con, "set standard_conforming_strings to 'off'")
+ dbGetQuery(con, "set escape_string_warning to 'off'")
++ cat("Show encoded string when standard_conforming_strings is off.\n")
+ print(postgresqlEscapeBytea(con, ser))
+ iq <- sprintf("INSERT INTO byteatable values('%s', '%s');", "name2",
postgresqlEscapeBytea(con, ser))
+ dbGetQuery(con, iq)
@@ -75,8 +78,20 @@
+ dbDisconnect(con)
+ dbUnloadDriver(drv)
+ cat("DONE\n")
++ }else{
++ cat("Skip because envirinmental variables are not set to tell the
connection params.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Note the encoded string could differ depending on the server.
+Show encoded string when standard_conforming_strings is on.
+[1] "X\\012\\000\\000\\000\\002\\000\\003\\000\\000\\000\\002\\003\\000\\000\\000\\000\\023\\000\\000\\000\\002\\000\\000\\000\\020\\000\\000\\000\\001\\000\\004\\000\\011\\000\\000\\000\\003one\\000\\000\\000\\020\\000\\000\\000\\001\\000\\004\\000\\011\\000\\000\\000\\003two"
+PASS: Identical data was recovered
+Show encoded string when standard_conforming_strings is off.
+[1] "X\\\\012\\\\000\\\\000\\\\000\\\\002\\\\000\\\\003\\\\000\\\\000\\\\000\\\\002\\\\003\\\\000\\\\000\\\\000\\\\000\\\\023\\\\000\\\\000\\\\000\\\\002\\\\000\\\\000\\\\000\\\\020\\\\000\\\\000\\\\000\\\\001\\\\000\\\\004\\\\000\\\\011\\\\000\\\\000\\\\000\\\\003one\\\\000\\\\000\\\\000\\\\020\\\\000\\\\000\\\\000\\\\001\\\\000\\\\004\\\\000\\\\011\\\\000\\\\000\\\\000\\\\003two"
+PASS: Identical data was recovered
+DONE
>
> proc.time()
user system elapsed
- 0.170 0.025 0.181
+ 0.429 0.034 0.522
=======================================
--- /trunk/RPostgreSQL/tests/connectWithNull.R Mon Oct 19 20:59:30 2009 UTC
+++ /trunk/RPostgreSQL/tests/connectWithNull.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,4 +1,3 @@
-
## connectWithNull test
##
## test for the 'Issue 2' on the Google Code issue log
@@ -21,8 +20,10 @@
## load the PostgresSQL driver
drv <- dbDriver("PostgreSQL")
- ## connect to the default db -- replacing any of these with NULL will
lead to
- ## a stop() call and a return to the R prompt rather than a segfault
+ ## connect to the default db -- replacing any of these with NULL
+ ## should be treated as the default value.
+ ## Thus, success or failure depends on the environment.
+ ## Importantly, Segmentation fault should not happen.
con <- dbConnect(drv,
user=Sys.getenv("POSTGRES_USER"),
password=Sys.getenv("POSTGRES_PASSWD"),
@@ -31,8 +32,69 @@
port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
## do we get here?
+ cat("Normal connection\n")
+ cat("Note connection handle will change every time\n")
print(con)
+ ## and disconnect
+ dbDisconnect(con)
+ cat("connection with user=NULL\n")
+ try({
+ con <- dbConnect(drv,
+ user=NULL,
+ password=Sys.getenv("POSTGRES_PASSWD"),
+ host=Sys.getenv("POSTGRES_HOST"),
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+ print(con)
+ dbDisconnect(con)
+ })
+ try({
+ cat("connection with password=NULL\n")
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=NULL,
+ host=Sys.getenv("POSTGRES_HOST"),
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+ print(con)
+ dbDisconnect(con)
+ })
+ try({
+ cat("connection with host=NULL\n")
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=Sys.getenv("POSTGRES_PASSWD"),
+ host=NULL,
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+ print(con)
+ dbDisconnect(con)
+ })
+ try({
+ cat("connection with dbname=NULL\n")
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=Sys.getenv("POSTGRES_PASSWD"),
+ host=Sys.getenv("POSTGRES_HOST"),
+ dbname=NULL,
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+ print(con)
+ dbDisconnect(con)
+ })
+ try({
+ cat("connection with port=NULL\n")
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=Sys.getenv("POSTGRES_PASSWD"),
+ host=Sys.getenv("POSTGRES_HOST"),
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=NULL)
+ print(con)
## and disconnect
dbDisconnect(con)
+ })
+ cat("PASS: reached to the end of the test code without segmentation
fault\n")
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/connectWithNull.Rout.save Sat Sep 11 15:56:08
2010 UTC
+++ /trunk/RPostgreSQL/tests/connectWithNull.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,7 +1,7 @@
-R version 2.11.1 (2010-05-31)
-Copyright (C) 2010 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -15,7 +15,6 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## connectWithNull test
> ##
> ## test for the 'Issue 2' on the Google Code issue log
@@ -38,8 +37,10 @@
+ ## load the PostgresSQL driver
+ drv <- dbDriver("PostgreSQL")
+
-+ ## connect to the default db -- replacing any of these with NULL
will lead to
-+ ## a stop() call and a return to the R prompt rather than a segfault
++ ## connect to the default db -- replacing any of these with NULL
++ ## should be treated as the default value.
++ ## Thus, success or failure depends on the environment.
++ ## Importantly, Segmentation fault should not happen.
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=Sys.getenv("POSTGRES_PASSWD"),
@@ -48,9 +49,91 @@
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
+
+ ## do we get here?
++ cat("Normal connection\n")
++ cat("Note connection handle will change every time\n")
+ print(con)
++ ## and disconnect
++ dbDisconnect(con)
+
++ cat("connection with user=NULL\n")
++ try({
++ con <- dbConnect(drv,
++ user=NULL,
++ password=Sys.getenv("POSTGRES_PASSWD"),
++ host=Sys.getenv("POSTGRES_HOST"),
++ dbname=Sys.getenv("POSTGRES_DATABASE"),
++ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
++ print(con)
++ dbDisconnect(con)
++ })
++ try({
++ cat("connection with password=NULL\n")
++ con <- dbConnect(drv,
++ user=Sys.getenv("POSTGRES_USER"),
++ password=NULL,
++ host=Sys.getenv("POSTGRES_HOST"),
++ dbname=Sys.getenv("POSTGRES_DATABASE"),
++ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
++ print(con)
++ dbDisconnect(con)
++ })
++ try({
++ cat("connection with host=NULL\n")
++ con <- dbConnect(drv,
++ user=Sys.getenv("POSTGRES_USER"),
++ password=Sys.getenv("POSTGRES_PASSWD"),
++ host=NULL,
++ dbname=Sys.getenv("POSTGRES_DATABASE"),
++ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
++ print(con)
++ dbDisconnect(con)
++ })
++ try({
++ cat("connection with dbname=NULL\n")
++ con <- dbConnect(drv,
++ user=Sys.getenv("POSTGRES_USER"),
++ password=Sys.getenv("POSTGRES_PASSWD"),
++ host=Sys.getenv("POSTGRES_HOST"),
++ dbname=NULL,
++ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
++ print(con)
++ dbDisconnect(con)
++ })
++ try({
++ cat("connection with port=NULL\n")
++ con <- dbConnect(drv,
++ user=Sys.getenv("POSTGRES_USER"),
++ password=Sys.getenv("POSTGRES_PASSWD"),
++ host=Sys.getenv("POSTGRES_HOST"),
++ dbname=Sys.getenv("POSTGRES_DATABASE"),
++ port=NULL)
++ print(con)
+ ## and disconnect
+ dbDisconnect(con)
++ })
++ cat("PASS: reached to the end of the test code without segmentation
fault\n")
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Normal connection
+Note connection handle will change every time
+<PostgreSQLConnection:(24160,0)>
+connection with user=NULL
+<PostgreSQLConnection:(24160,1)>
+connection with password=NULL
+<PostgreSQLConnection:(24160,2)>
+connection with host=NULL
+<PostgreSQLConnection:(24160,3)>
+connection with dbname=NULL
+Error in postgresqlNewConnection(drv, ...) :
+ RS-DBI driver: (could not connect testuser@localhost on dbname "testuser"
+)
+connection with port=NULL
+<PostgreSQLConnection:(24160,4)>
+PASS: reached to the end of the test code without segmentation fault
>
+> proc.time()
+ user system elapsed
+ 0.421 0.031 0.452
=======================================
--- /trunk/RPostgreSQL/tests/createTableMixedCaseTest.R Mon Mar 7 10:19:41
2011 UTC
+++ /trunk/RPostgreSQL/tests/createTableMixedCaseTest.R Sat Feb 8 09:29:04
2014 UTC
@@ -1,4 +1,3 @@
-
## createTableMixedCaseTest test
##
##
@@ -81,4 +80,6 @@
res <- dbGetQuery(con, "drop table \"Foo2\"")
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/createTableMixedCaseTest.Rout.save Sun Sep 25
14:25:47 2011 UTC
+++ /trunk/RPostgreSQL/tests/createTableMixedCaseTest.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,8 +1,7 @@
-R version 2.13.1 (2011-07-08)
-Copyright (C) 2011 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
-Platform: x86_64-pc-linux-gnu (64-bit)
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -16,7 +15,6 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## createTableMixedCaseTest test
> ##
> ##
@@ -99,5 +97,20 @@
+ res <- dbGetQuery(con, "drop table \"Foo2\"")
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Test should create foo1 and Foo2 tables
+Pass - Foo1 Table does not exist.
+Pass - foo1 Table exists.
+Pass - Foo2 Table exists.
+Pass - foo2 Table does not exist.
+Pass - "Foo2" Table does not exist.
+Pass - "foo2" Table does not exist.
+[1] TRUE
>
+> proc.time()
+ user system elapsed
+ 0.452 0.030 0.501
=======================================
--- /trunk/RPostgreSQL/tests/dataTypeTests.R Mon Mar 7 10:19:41 2011 UTC
+++ /trunk/RPostgreSQL/tests/dataTypeTests.R Sat Feb 8 09:29:04 2014 UTC
@@ -110,4 +110,6 @@
dbUnloadDriver(drv)
cat("DONE\n")
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dataTypeTests.Rout.save Sun Sep 25 14:25:47
2011 UTC
+++ /trunk/RPostgreSQL/tests/dataTypeTests.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,8 +1,7 @@
-R version 2.13.1 (2011-07-08)
-Copyright (C) 2011 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
-Platform: x86_64-pc-linux-gnu (64-bit)
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -128,5 +127,22 @@
+ dbUnloadDriver(drv)
+
+ cat("DONE\n")
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Read Numeric values
+GOOD -- all numeric types are as expected
+GOOD -- all numeric values are as expected
+Read Logical values
+GOOD -- all logical types are as expected
+GOOD -- all logical values are as expected
+Read Character values
+GOOD -- all character types are as expected
+GOOD -- all character values are as expected
+DONE
>
+> proc.time()
+ user system elapsed
+ 0.516 0.034 0.630
=======================================
--- /trunk/RPostgreSQL/tests/dateTZ.R Thu Oct 18 07:16:04 2012 UTC
+++ /trunk/RPostgreSQL/tests/dateTZ.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,8 +1,33 @@
-
-## Test of date and datetime types, based on earlier version in
inst/devTests
+## Test of date and datetime types with time zone
##
## Dirk Eddelbuettel, 21 Oct 2008
+## only run this if this env.var is set correctly
+if ((Sys.getenv("POSTGRES_USER") != "") &
+ (Sys.getenv("POSTGRES_HOST") != "") &
+ (Sys.getenv("POSTGRES_DATABASE") != "")) {
+
+ ## try to load our module and abort if this fails
+ stopifnot(require(RPostgreSQL))
+
+ ## Force a timezone to make the tests comparable at different locations
+ Sys.setenv("TZ"="UTC")
+ tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02
13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
+ print(tt)
+
+ ## load the PostgresSQL driver
+ drv <- dbDriver("PostgreSQL")
+ ## can't print result as it contains process id which changes
print(summary(drv))
+
+ ## connect to the default db
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=Sys.getenv("POSTGRES_PASSWD"),
+ host=Sys.getenv("POSTGRES_HOST"),
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+
+
dbTypeTests <- function(con, dateclass="timestamp without time zone",
tz="UTC") {
cat("\n\n**** Trying with ", dateclass, "\n")
@@ -44,32 +69,6 @@
dbRemoveTable(con, "tempostgrestable")
invisible(NULL)
}
-
-## only run this if this env.var is set correctly
-if ((Sys.getenv("POSTGRES_USER") != "") &
- (Sys.getenv("POSTGRES_HOST") != "") &
- (Sys.getenv("POSTGRES_DATABASE") != "")) {
-
- ## try to load our module and abort if this fails
- stopifnot(require(RPostgreSQL))
-
- ## Force a timezone to make the tests comparable at different locations
- Sys.setenv("TZ"="UTC")
- tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02
13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
- print(tt)
-
- ## load the PostgresSQL driver
- drv <- dbDriver("PostgreSQL")
- ## can't print result as it contains process id which changes
print(summary(drv))
-
- ## connect to the default db
- con <- dbConnect(drv,
- user=Sys.getenv("POSTGRES_USER"),
- password=Sys.getenv("POSTGRES_PASSWD"),
- host=Sys.getenv("POSTGRES_HOST"),
- dbname=Sys.getenv("POSTGRES_DATABASE"),
- port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
-
cat('testing UTC')
dbTypeTests(con, "timestamp")
dbTypeTests(con, "timestamp with time zone")
@@ -84,5 +83,7 @@
dbTypeTests(con, "timestamp with time zone", tz="America/New_York")
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dateTZ.Rout.save Wed Mar 27 07:19:14 2013 UTC
+++ /trunk/RPostgreSQL/tests/dateTZ.Rout.save Sat Feb 8 09:29:04 2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,12 +15,37 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## Test of date and datetime types, based on earlier version in
inst/devTests
+> ## Test of date and datetime types with time zone
> ##
> ## Dirk Eddelbuettel, 21 Oct 2008
>
-> dbTypeTests <- function(con, dateclass="timestamp without time zone",
tz="UTC") {
+> ## only run this if this env.var is set correctly
+> if ((Sys.getenv("POSTGRES_USER") != "") &
++ (Sys.getenv("POSTGRES_HOST") != "") &
++ (Sys.getenv("POSTGRES_DATABASE") != "")) {
++
++ ## try to load our module and abort if this fails
++ stopifnot(require(RPostgreSQL))
++
++ ## Force a timezone to make the tests comparable at different
locations
++ Sys.setenv("TZ"="UTC")
++ tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02
13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
++ print(tt)
++
++ ## load the PostgresSQL driver
++ drv <- dbDriver("PostgreSQL")
++ ## can't print result as it contains process id which changes
print(summary(drv))
++
++ ## connect to the default db
++ con <- dbConnect(drv,
++ user=Sys.getenv("POSTGRES_USER"),
++ password=Sys.getenv("POSTGRES_PASSWD"),
++ host=Sys.getenv("POSTGRES_HOST"),
++ dbname=Sys.getenv("POSTGRES_DATABASE"),
++ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
++
++
++ dbTypeTests <- function(con, dateclass="timestamp without time zone",
tz="UTC") {
+ cat("\n\n**** Trying with ", dateclass, "\n")
+
+ if (dbExistsTable(con, "tempostgrestable"))
@@ -62,32 +86,6 @@
+ dbRemoveTable(con, "tempostgrestable")
+ invisible(NULL)
+ }
->
-> ## only run this if this env.var is set correctly
-> if ((Sys.getenv("POSTGRES_USER") != "") &
-+ (Sys.getenv("POSTGRES_HOST") != "") &
-+ (Sys.getenv("POSTGRES_DATABASE") != "")) {
-+
-+ ## try to load our module and abort if this fails
-+ stopifnot(require(RPostgreSQL))
-+
-+ ## Force a timezone to make the tests comparable at different
locations
-+ Sys.setenv("TZ"="UTC")
-+ tt<-as.POSIXct(c("2008-07-01 23:45:16.123+0930","2000-01-02
13:34:05.678+1030"), format="%Y-%m-%d %H:%M:%OS%z")
-+ print(tt)
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+ ## can't print result as it contains process id which changes
print(summary(drv))
-+
-+ ## connect to the default db
-+ con <- dbConnect(drv,
-+ user=Sys.getenv("POSTGRES_USER"),
-+ password=Sys.getenv("POSTGRES_PASSWD"),
-+ host=Sys.getenv("POSTGRES_HOST"),
-+ dbname=Sys.getenv("POSTGRES_DATABASE"),
-+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
-+
+ cat('testing UTC')
+ dbTypeTests(con, "timestamp")
+ dbTypeTests(con, "timestamp with time zone")
@@ -102,9 +100,87 @@
+ dbTypeTests(con, "timestamp with time zone", tz="America/New_York")
+
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+testing UTC
+
+**** Trying with timestamp
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+
+
+**** Trying with timestamp with time zone
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+testing Asia/Tokyo
+
+**** Trying with timestamp
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+
+
+**** Trying with timestamp with time zone
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+testing Australlia/South
+
+**** Trying with timestamp
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+
+
+**** Trying with timestamp with time zone
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+testing America/New_York
+
+**** Trying with timestamp
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+
+
+**** Trying with timestamp with time zone
+inserted string 1: 2008-07-01 14:15:16.123+00
+inserted string 2: 2000-01-02 03:04:05.678+00
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+PASS
+PASS
+[1] TRUE
>
>
> proc.time()
user system elapsed
- 0.131 0.027 0.141
+ 0.744 0.035 0.975
=======================================
--- /trunk/RPostgreSQL/tests/datetimeTests.R Thu Oct 18 07:16:04 2012 UTC
+++ /trunk/RPostgreSQL/tests/datetimeTests.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,8 +1,31 @@
-
## Test of date and datetime types, based on earlier version in
inst/devTests
##
## Dirk Eddelbuettel, 21 Oct 2008
+## only run this if this env.var is set correctly
+if ((Sys.getenv("POSTGRES_USER") != "") &
+ (Sys.getenv("POSTGRES_HOST") != "") &
+ (Sys.getenv("POSTGRES_DATABASE") != "")) {
+
+ ## try to load our module and abort if this fails
+ stopifnot(require(RPostgreSQL))
+
+ ## Force a timezone to make the tests comparable at different locations
+ Sys.setenv("PGDATESTYLE"="German")
+ Sys.setenv("TZ"="UTC")
+
+ ## load the PostgresSQL driver
+ drv <- dbDriver("PostgreSQL")
+ ## can't print result as it contains process id which changes
print(summary(drv))
+
+ ## connect to the default db
+ con <- dbConnect(drv,
+ user=Sys.getenv("POSTGRES_USER"),
+ password=Sys.getenv("POSTGRES_PASSWD"),
+ host=Sys.getenv("POSTGRES_HOST"),
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+
dbTypeTests <- function(con, dateclass="timestamp without time zone") {
cat("\n\n**** Trying with ", dateclass, "\n")
@@ -32,34 +55,12 @@
invisible(NULL)
}
-## only run this if this env.var is set correctly
-if ((Sys.getenv("POSTGRES_USER") != "") &
- (Sys.getenv("POSTGRES_HOST") != "") &
- (Sys.getenv("POSTGRES_DATABASE") != "")) {
-
- ## try to load our module and abort if this fails
- stopifnot(require(RPostgreSQL))
-
- ## Force a timezone to make the tests comparable at different locations
- Sys.setenv("PGDATESTYLE"="German")
- Sys.setenv("TZ"="UTC")
-
- ## load the PostgresSQL driver
- drv <- dbDriver("PostgreSQL")
- ## can't print result as it contains process id which changes
print(summary(drv))
-
- ## connect to the default db
- con <- dbConnect(drv,
- user=Sys.getenv("POSTGRES_USER"),
- password=Sys.getenv("POSTGRES_PASSWD"),
- host=Sys.getenv("POSTGRES_HOST"),
- dbname=Sys.getenv("POSTGRES_DATABASE"),
- port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
dbTypeTests(con, "timestamp")
dbTypeTests(con, "timestamp with time zone")
dbTypeTests(con, "date")
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
-
=======================================
--- /trunk/RPostgreSQL/tests/datetimeTests.Rout.save Wed Mar 27 07:19:14
2013 UTC
+++ /trunk/RPostgreSQL/tests/datetimeTests.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,12 +15,35 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## Test of date and datetime types, based on earlier version in
inst/devTests
> ##
> ## Dirk Eddelbuettel, 21 Oct 2008
>
-> dbTypeTests <- function(con, dateclass="timestamp without time zone") {
+> ## only run this if this env.var is set correctly
+> if ((Sys.getenv("POSTGRES_USER") != "") &
++ (Sys.getenv("POSTGRES_HOST") != "") &
++ (Sys.getenv("POSTGRES_DATABASE") != "")) {
++
++ ## try to load our module and abort if this fails
++ stopifnot(require(RPostgreSQL))
++
++ ## Force a timezone to make the tests comparable at different
locations
++ Sys.setenv("PGDATESTYLE"="German")
++ Sys.setenv("TZ"="UTC")
++
++ ## load the PostgresSQL driver
++ drv <- dbDriver("PostgreSQL")
++ ## can't print result as it contains process id which changes
print(summary(drv))
++
++ ## connect to the default db
++ con <- dbConnect(drv,
++ user=Sys.getenv("POSTGRES_USER"),
++ password=Sys.getenv("POSTGRES_PASSWD"),
++ host=Sys.getenv("POSTGRES_HOST"),
++ dbname=Sys.getenv("POSTGRES_DATABASE"),
++ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
++
++ dbTypeTests <- function(con, dateclass="timestamp without time zone") {
+ cat("\n\n**** Trying with ", dateclass, "\n")
+
+ if (dbExistsTable(con, "tempostgrestable"))
@@ -49,39 +71,53 @@
+ dbRemoveTable(con, "tempostgrestable")
+ invisible(NULL)
+ }
->
-> ## only run this if this env.var is set correctly
-> if ((Sys.getenv("POSTGRES_USER") != "") &
-+ (Sys.getenv("POSTGRES_HOST") != "") &
-+ (Sys.getenv("POSTGRES_DATABASE") != "")) {
+
-+ ## try to load our module and abort if this fails
-+ stopifnot(require(RPostgreSQL))
-+
-+ ## Force a timezone to make the tests comparable at different
locations
-+ Sys.setenv("PGDATESTYLE"="German")
-+ Sys.setenv("TZ"="UTC")
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+ ## can't print result as it contains process id which changes
print(summary(drv))
-+
-+ ## connect to the default db
-+ con <- dbConnect(drv,
-+ user=Sys.getenv("POSTGRES_USER"),
-+ password=Sys.getenv("POSTGRES_PASSWD"),
-+ host=Sys.getenv("POSTGRES_HOST"),
-+ dbname=Sys.getenv("POSTGRES_DATABASE"),
-+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
+
+ dbTypeTests(con, "timestamp")
+ dbTypeTests(con, "timestamp with time zone")
+ dbTypeTests(con, "date")
+
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
->
+Loading required package: RPostgreSQL
+Loading required package: DBI
+
+
+**** Trying with timestamp
+ tt zz
+1 2008-07-01 14:15:16 1
+2 2000-01-02 03:04:05 2
+ name Sclass type len precision scale nullOK
+1 tt POSIXct TIMESTAMP 8 -1 -1 TRUE
+[1] "2008-07-01 14:15:16 UTC" "2000-01-02 03:04:05 UTC"
+[1] "POSIXct" "POSIXt"
+Time difference of -3103.466 days
+
+
+**** Trying with timestamp with time zone
+ tt zz
+1 2008-07-01 05:15:16 1
+2 2000-01-01 18:04:05 2
+ name Sclass type len precision scale nullOK
+1 tt POSIXct TIMESTAMPTZOID 8 -1 -1 TRUE
+[1] "2008-07-01 05:15:16 UTC" "2000-01-01 18:04:05 UTC"
+[1] "POSIXct" "POSIXt"
+Time difference of -3103.466 days
+
+
+**** Trying with date
+ tt zz
+1 2008-07-01 1
+2 2000-01-02 2
+ name Sclass type len precision scale nullOK
+1 tt Date DATE 4 -1 -1 TRUE
+[1] "2008-07-01" "2000-01-02"
+[1] "Date"
+Time difference of -3103 days
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.130 0.022 0.134
+ 0.539 0.029 0.694
=======================================
--- /trunk/RPostgreSQL/tests/datetimestampwrite.R Mon Mar 7 10:11:32 2011
UTC
+++ /trunk/RPostgreSQL/tests/datetimestampwrite.R Sat Feb 8 09:29:04 2014
UTC
@@ -77,4 +77,6 @@
dbUnloadDriver(drv)
cat("DONE\n")
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/datetimestampwrite.Rout.save Wed Mar 27
07:19:14 2013 UTC
+++ /trunk/RPostgreSQL/tests/datetimestampwrite.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -95,8 +94,19 @@
+ dbUnloadDriver(drv)
+
+ cat("DONE\n")
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Read Date and TIMESTAMP values
+PASS -- Date type is as expected
+PASS -- TIMESTAMP is received as POSIXct
+Check that read after write gets the same data types
+PASS -- Date type is as expected
+PASS -- TIMESTAMP is received as POSIXct
+DONE
>
> proc.time()
user system elapsed
- 0.137 0.017 0.138
+ 0.475 0.030 0.553
=======================================
--- /trunk/RPostgreSQL/tests/dbColumnInfo.R Thu Oct 4 10:20:50 2012 UTC
+++ /trunk/RPostgreSQL/tests/dbColumnInfo.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,5 +1,7 @@
-
-## dbWriteTable test
+## dbColumnInfo test
+## This test confirms that dbColumnInfo() will not cause segfault under
gctorture()
+## Initial report was sporadic segfault (Issue 42)
+## and it was found reproducile under gctorture()
##
## Assumes that
## a) PostgreSQL is running, and
@@ -32,6 +34,7 @@
## run a simple query and show the query result
res <- dbGetQuery(con, "INSERT INTO aa VALUES(3, 2, NULL)" )
res <- dbSendQuery(con, "select pk, v1, v2, v1+v2 from aa")
+ cat("This would take a while due to gctorture()\n")
cat("dbColumnInfo\n")
gctorture()
print(dbColumnInfo(res))
@@ -45,4 +48,6 @@
dbRemoveTable(con, "aa")
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbColumnInfo.Rout.save Fri Oct 5 00:55:35
2012 UTC
+++ /trunk/RPostgreSQL/tests/dbColumnInfo.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,8 +15,10 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## dbWriteTable test
+> ## dbColumnInfo test
+> ## This test confirms that dbColumnInfo() will not cause segfault under
gctorture()
+> ## Initial report was sporadic segfault (Issue 42)
+> ## and it was found reproducile under gctorture()
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -50,6 +51,7 @@
+ ## run a simple query and show the query result
+ res <- dbGetQuery(con, "INSERT INTO aa VALUES(3, 2, NULL)" )
+ res <- dbSendQuery(con, "select pk, v1, v2, v1+v2 from aa")
++ cat("This would take a while due to gctorture()\n")
+ cat("dbColumnInfo\n")
+ gctorture()
+ print(dbColumnInfo(res))
@@ -63,8 +65,30 @@
+ dbRemoveTable(con, "aa")
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "aa_pkey"
for table "aa"
+This would take a while due to gctorture()
+dbColumnInfo
+ name Sclass type len precision scale nullOK
+1 pk integer INTEGER 4 -1 -1 FALSE
+2 v1 double FLOAT8 8 -1 -1 FALSE
+3 v2 double FLOAT8 8 -1 -1 TRUE
+4 ?column? double FLOAT8 8 -1 -1 NA
+ name Sclass type len precision scale nullOK
+1 pk integer INTEGER 4 -1 -1 FALSE
+2 v1 double FLOAT8 8 -1 -1 FALSE
+3 v2 double FLOAT8 8 -1 -1 TRUE
+4 ?column? double FLOAT8 8 -1 -1 NA
+SELECT result
+ pk v1 v2 ?column?
+1 3 2 NA NA
+Removing "AA"
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.127 0.016 0.132
+ 75.272 0.032 75.427
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsIssue.R Wed Oct 13 10:35:56 2010 UTC
+++ /trunk/RPostgreSQL/tests/dbExistsIssue.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,4 +1,3 @@
-
## dbExists test with schema name: reported as Issue 3 at
##
http://code.google.com/p/rpostgresql/issues/detail?id=3
## and based on an earlier email by Prasenjit Kapat
@@ -51,4 +50,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsIssue.Rout.save Wed Oct 13 14:45:53
2010 UTC
+++ /trunk/RPostgreSQL/tests/dbExistsIssue.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,7 +1,7 @@
-R version 2.11.1 (2010-05-31)
-Copyright (C) 2010 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -15,7 +15,6 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## dbExists test with schema name: reported as Issue 3 at
> ##
http://code.google.com/p/rpostgresql/issues/detail?id=3
> ## and based on an earlier email by Prasenjit Kapat
@@ -68,5 +67,16 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Does rockdata exist? [1] TRUE
+Does public.rockdata exist? [1] FALSE
+[1] "Removing rockdata\n"
+[1] TRUE
>
+> proc.time()
+ user system elapsed
+ 0.464 0.026 0.555
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsq.R Wed Oct 13 03:07:19 2010 UTC
+++ /trunk/RPostgreSQL/tests/dbExistsq.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,8 +1,10 @@
-
## dbExists test with schema name: reported as Issue 3 at
##
http://code.google.com/p/rpostgresql/issues/detail?id=3
## and based on an earlier email by Prasenjit Kapat
##
+## This test is for additional case where the name contains
+## single quote characters.
+##
## Assumes that
## a) PostgreSQL is running, and
## b) the current user can connect
@@ -52,4 +54,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsq.Rout.save Wed Oct 13 14:44:59 2010
UTC
+++ /trunk/RPostgreSQL/tests/dbExistsq.Rout.save Sat Feb 8 09:29:04 2014
UTC
@@ -1,8 +1,7 @@
-R version 2.12.0 RC (2010-10-07 r53227)
-Copyright (C) 2010 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
-Platform: x86_64-pc-linux-gnu (64-bit)
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -16,11 +15,13 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## dbExists test with schema name: reported as Issue 3 at
> ##
http://code.google.com/p/rpostgresql/issues/detail?id=3
> ## and based on an earlier email by Prasenjit Kapat
> ##
+> ## This test is for additional case where the name contains
+> ## single quote characters.
+> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
> ## b) the current user can connect
@@ -70,5 +71,17 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Write rock'data
+Does rock'data exist? [1] TRUE
+Does "public.rock'data" exist? [1] FALSE
+Removing rock'data
+[1] TRUE
>
+> proc.time()
+ user system elapsed
+ 0.458 0.028 0.577
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsqc.R Sun Mar 6 06:32:48 2011 UTC
+++ /trunk/RPostgreSQL/tests/dbExistsqc.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,4 +1,3 @@
-
## dbExistsq test with schema name: reported as Issue 28 at
##
http://code.google.com/p/rpostgresql/issues/detail?id=28
##
@@ -90,4 +89,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsqc.Rout.save Wed Mar 27 07:19:14 2013
UTC
+++ /trunk/RPostgreSQL/tests/dbExistsqc.Rout.save Sat Feb 8 09:29:04 2014
UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,7 +15,6 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## dbExistsq test with schema name: reported as Issue 28 at
> ##
http://code.google.com/p/rpostgresql/issues/detail?id=28
> ##
@@ -108,8 +106,25 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Does rock.data exist?
+PASS: true
+create schema testschema and change the search_path
+Does rock.data exist?
+PASS: false as the search_path changed
+Does testschema."rock.data" exist?
+PASS: false as the testschema specified
+Does public."rock.data" exist?
+PASS: true despite search_path change
+write in current schema
+Does rock.data exist?
+PASS: true
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.142 0.016 0.142
+ 0.535 0.034 0.718
=======================================
--- /trunk/RPostgreSQL/tests/dbGetQueryParams.R Thu Dec 6 14:26:41 2012 UTC
+++ /trunk/RPostgreSQL/tests/dbGetQueryParams.R Sat Feb 8 09:29:04 2014 UTC
@@ -46,4 +46,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbGetQueryParams.Rout.save Wed Mar 27 07:19:14
2013 UTC
+++ /trunk/RPostgreSQL/tests/dbGetQueryParams.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -64,8 +63,31 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+ row.names area peri shape perm
+1 6 7979 4010.15 0.167045 17.1
+2 7 9333 4345.75 0.189651 17.1
+3 8 8209 4344.75 0.164127 17.1
+4 11 9364 4480.05 0.150944 119.0
+5 13 10651 4036.54 0.228595 82.4
+6 17 10962 4608.66 0.204314 58.6
+7 18 10743 4787.62 0.262727 58.6
+8 19 11878 4864.22 0.200071 58.6
+9 20 9867 4479.41 0.144810 58.6
+10 22 11876 4353.14 0.291029 142.0
+ row.names area peri shape perm
+1 6 7979 4010.15 0.167045 17.1
+2 7 9333 4345.75 0.189651 17.1
+3 8 8209 4344.75 0.164127 17.1
+4 11 9364 4480.05 0.150944 119.0
+5 20 9867 4479.41 0.144810 58.6
+[1] "Removing rockdata\n"
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.127 0.022 0.133
+ 0.447 0.030 0.569
=======================================
--- /trunk/RPostgreSQL/tests/dbListFields.R Sun Sep 25 07:47:34 2011 UTC
+++ /trunk/RPostgreSQL/tests/dbListFields.R Sat Feb 8 09:29:04 2014 UTC
@@ -54,4 +54,6 @@
dbGetQuery(con, "DROP SCHEMA testschema")
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbListFields.Rout.save Wed Mar 27 07:19:14
2013 UTC
+++ /trunk/RPostgreSQL/tests/dbListFields.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -72,8 +71,18 @@
+ dbGetQuery(con, "DROP SCHEMA testschema")
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+[1] "pk" "v1" "v2"
+PASS: 3 fields returned
+[1] "pid" "name"
+PASS: 2 fields returned
+Removing "AA"
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.134 0.018 0.136
+ 0.426 0.027 0.500
=======================================
--- /trunk/RPostgreSQL/tests/dbTransactionTests.R Thu Mar 29 06:02:03 2012
UTC
+++ /trunk/RPostgreSQL/tests/dbTransactionTests.R Sat Feb 8 09:29:04 2014
UTC
@@ -1,5 +1,4 @@
-
-## dbWriteTable test
+## Transaction test using two connections
##
## Assumes that
## a) PostgreSQL is running, and
@@ -90,4 +89,6 @@
## and disconnect
dbDisconnect(con2)
dbDisconnect(con1)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbTransactionTests.Rout.save Wed Mar 27
07:19:14 2013 UTC
+++ /trunk/RPostgreSQL/tests/dbTransactionTests.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,8 +15,7 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## dbWriteTable test
+> ## Transaction test using two connections
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -108,8 +106,26 @@
+ ## and disconnect
+ dbDisconnect(con2)
+ dbDisconnect(con1)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+begin transaction in con1
+create table rockdata in con1
+PASS rockdata is visible through con1
+PASS rockdata is invisible through con2
+commit in con1
+PASS rockdata is visible through con2
+remove the table from con1
+PASS rockdata is invisible through con2
+begin transaction in con1
+create table rockdata in con1
+PASS rockdata is visible through con1
+RollBack con1
+PASS rockdata is invisible through con1
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.139 0.020 0.143
+ 0.553 0.039 0.748
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableFailTest.R Wed Nov 3 06:09:38
2010 UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTableFailTest.R Sat Feb 8 09:29:04
2014 UTC
@@ -1,5 +1,4 @@
-
-## dbWriteTable test
+## dbWriteTable fail test
##
## Assumes that
## a) PostgreSQL is running, and
@@ -67,4 +66,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableFailTest.Rout.save Wed Mar 27
07:19:14 2013 UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTableFailTest.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,8 +15,7 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## dbWriteTable test
+> ## dbWriteTable fail test
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -85,8 +83,26 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+create incompatible table rockdata
+write table to rockdata with append=TRUE
+Error in postgresqlpqExec(new.con, sql4) :
+ RS-DBI driver: (could not Retrieve the result : ERROR:
column "row.names" of relation "rockdata" does not exist
+)
+write table to rockdata
+[1] FALSE
+PASS as the return value is false
+data frame with 0 columns and 0 rows
+[1] "Removing rockdata\n"
+[1] TRUE
+Warning message:
+In postgresqlWriteTable(conn, name, value, ...) :
+ table rockdata exists in database: aborting assignTable
>
> proc.time()
user system elapsed
- 0.139 0.018 0.141
+ 0.453 0.028 0.565
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableSchema.R Sun Mar 6 06:32:48 2011
UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTableSchema.R Sat Feb 8 09:29:04 2014
UTC
@@ -1,4 +1,3 @@
-
## dbWriteTable test
##
## Assumes that
@@ -47,4 +46,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableSchema.Rout.save Wed Mar 27
07:19:14 2013 UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTableSchema.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,7 +15,6 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## dbWriteTable test
> ##
> ## Assumes that
@@ -65,8 +63,25 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+ row.names area peri shape perm
+1 1 4990 2791.90 0.0903296 6.3
+2 2 7002 3892.60 0.1486220 6.3
+3 3 7558 3930.66 0.1833120 6.3
+4 4 7352 3869.32 0.1170630 6.3
+5 5 7943 3948.54 0.1224170 17.1
+6 6 7979 4010.15 0.1670450 17.1
+7 7 9333 4345.75 0.1896510 17.1
+8 8 8209 4344.75 0.1641270 17.1
+9 9 8393 3682.04 0.2036540 119.0
+10 10 6425 3098.65 0.1623940 119.0
+[1] "Removing rockdata\n"
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.130 0.023 0.136
+ 0.417 0.035 0.509
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableTest.R Fri Jun 21 10:49:21 2013 UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTableTest.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,5 +1,4 @@
-
-## dbWriteTable test
+## dbWriteTable test with append=T
##
## Assumes that
## a) PostgreSQL is running, and
@@ -52,4 +51,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableTest.Rout.save Tue Nov 12 07:47:26
2013 UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTableTest.Rout.save Sat Feb 8 09:29:04
2014 UTC
@@ -15,8 +15,7 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## dbWriteTable test
+> ## dbWriteTable test with append=T
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -69,8 +68,31 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+ row.names area peri shape perm
+1 1 4990 2791.90 0.0903296 6.3
+2 2 7002 3892.60 0.1486220 6.3
+3 3 7558 3930.66 0.1833120 6.3
+4 4 7352 3869.32 0.1170630 6.3
+5 5 7943 3948.54 0.1224170 17.1
+ row.names area peri shape perm
+1 1 4990 2791.90 0.0903296 6.3
+2 2 7002 3892.60 0.1486220 6.3
+3 3 7558 3930.66 0.1833120 6.3
+4 4 7352 3869.32 0.1170630 6.3
+5 5 7943 3948.54 0.1224170 17.1
+6 6 7979 4010.15 0.1670450 17.1
+7 7 9333 4345.75 0.1896510 17.1
+8 8 8209 4344.75 0.1641270 17.1
+9 9 8393 3682.04 0.2036540 119.0
+10 10 6425 3098.65 0.1623940 119.0
+[1] "Removing rockdata\n"
+[1] TRUE
>
> proc.time()
user system elapsed
- 0.170 0.018 0.175
+ 0.469 0.040 0.587
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTabletypes.R Tue Oct 4 09:43:27 2011
UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTabletypes.R Sat Feb 8 09:29:04 2014
UTC
@@ -1,4 +1,4 @@
-## dbWriteTable test
+## dbWriteTable test with various types
##
## Assumes that
## a) PostgreSQL is running, and
@@ -229,5 +229,7 @@
dbUnloadDriver(drv)
cat("DONE\n")
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTabletypes.Rout.save Wed Mar 27
07:19:14 2013 UTC
+++ /trunk/RPostgreSQL/tests/dbWriteTabletypes.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,7 +1,6 @@
-R version 2.15.2 (2012-10-26) -- "Trick or Treat"
-Copyright (C) 2012 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,7 +15,7 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
-> ## dbWriteTable test
+> ## dbWriteTable test with various types
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -247,9 +246,51 @@
+ dbUnloadDriver(drv)
+
+ cat("DONE\n")
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+ row.names strings
+1 1 normal
+2 2 t\tab
+3 3 v\vertical tab
+4 4 n\newline
+5 5 r carriage \retern
+6 6 back \\ slash
+7 7 f\form feed
+[1] "Removing rockdata\n"
+1 normal
+2 müß
+[1] "Removing rockdata\n"
+PASS: could write small umlaut u and ligature sz
+Error in postgresqlgetResult(new.con) :
+ RS-DBI driver: (could not Retrieve the result : ERROR: character
0xe6bca2 of encoding "UTF8" has no equivalent in "WIN1252"
+CONTEXT: COPY rockdata, line 2
+)
+FAIL: could not write kanji.
+ This might be no problem for you if you don't use multibyte
characters.
+ Otherwise, please check for the server encoding.
+ Database encoding is usually set at the time of createdb.
+ You can see for more information on how to setup at
+
http://www.postgresql.org/docs/9.1/static/multibyte.html
+
+[1] "Removing rockdata\n"
+Read Numeric values
+PASS -- all integer is as expected
+PASS integer value is preservedGOOD -- all numeric values are as expected
+Read Logical values
+GOOD -- all logical types are as expected
+GOOD -- all logical values are as expected
+Read Character values
+GOOD -- all character types are as expected
+GOOD -- all character values are as expected
+Check that read after write gets the same data types
+PASS -- Date type is as expected
+PASS -- TIMESTAMP is received as POSIXct
+DONE
>
>
> proc.time()
user system elapsed
- 0.217 0.020 0.221
+ 1.057 0.062 1.558
=======================================
--- /trunk/RPostgreSQL/tests/dbtemptable.R Mon Mar 7 10:19:41 2011 UTC
+++ /trunk/RPostgreSQL/tests/dbtemptable.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,5 +1,4 @@
-
-## dbWriteTable test
+## dbtemplate test
##
## Assumes that
## a) PostgreSQL is running, and
@@ -43,4 +42,6 @@
## and disconnect
dbDisconnect(con)
cat("PASS -- ended without segmentation fault\n")
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/dbtemptable.Rout.save Sun Sep 25 14:25:47 2011
UTC
+++ /trunk/RPostgreSQL/tests/dbtemptable.Rout.save Sat Feb 8 09:29:04 2014
UTC
@@ -1,8 +1,7 @@
-R version 2.13.1 (2011-07-08)
-Copyright (C) 2011 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
-Platform: x86_64-pc-linux-gnu (64-bit)
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -16,8 +15,7 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## dbWriteTable test
+> ## dbtemplate test
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -61,5 +59,15 @@
+ ## and disconnect
+ dbDisconnect(con)
+ cat("PASS -- ended without segmentation fault\n")
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+ name
+1 bar
+PASS -- ended without segmentation fault
>
+> proc.time()
+ user system elapsed
+ 0.372 0.037 0.465
=======================================
--- /trunk/RPostgreSQL/tests/escape.R Wed Oct 13 03:07:19 2010 UTC
+++ /trunk/RPostgreSQL/tests/escape.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,8 +1,6 @@
-
-## connectWithNull test
+## escape test
##
-## test for the 'Issue 2' on the Google Code issue log
-## reported in April 2009, still open ?
+## this tests for proper escaping of SQL special characters
##
## Assumes that
## a) PostgreSQL is running, and
@@ -30,11 +28,16 @@
dbname=Sys.getenv("POSTGRES_DATABASE"),
port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="", p,
5432))
+ cat("Note the appropriate string may differ upon server setting and
connection state.\n")
st <- (postgresqlEscapeStrings(con,"aaa"))
print(st)
st2 <- (postgresqlEscapeStrings(con,"aa'a"))
print(st2)
+ st3 <- (postgresqlEscapeStrings(con,"aa\\a"))
+ print(st3)
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/escape.Rout.save Wed Oct 13 14:44:59 2010 UTC
+++ /trunk/RPostgreSQL/tests/escape.Rout.save Sat Feb 8 09:29:04 2014 UTC
@@ -1,8 +1,7 @@
-R version 2.12.0 RC (2010-10-07 r53227)
-Copyright (C) 2010 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
-Platform: x86_64-pc-linux-gnu (64-bit)
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -16,11 +15,9 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
-> ## connectWithNull test
+> ## escape test
> ##
-> ## test for the 'Issue 2' on the Google Code issue log
-> ## reported in April 2009, still open ?
+> ## this tests for proper escaping of SQL special characters
> ##
> ## Assumes that
> ## a) PostgreSQL is running, and
@@ -48,12 +45,27 @@
+ dbname=Sys.getenv("POSTGRES_DATABASE"),
+ port=ifelse((p<-Sys.getenv("POSTGRES_PORT"))!="",
p, 5432))
+
++ cat("Note the appropriate string may differ upon server setting and
connection state.\n")
+ st <- (postgresqlEscapeStrings(con,"aaa"))
+ print(st)
+ st2 <- (postgresqlEscapeStrings(con,"aa'a"))
+ print(st2)
++ st3 <- (postgresqlEscapeStrings(con,"aa\\a"))
++ print(st3)
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+Note the appropriate string may differ upon server setting and connection
state.
+[1] "aaa"
+[1] "aa''a"
+[1] "aa\\\\a"
+[1] TRUE
>
+> proc.time()
+ user system elapsed
+ 0.359 0.027 0.375
=======================================
--- /trunk/RPostgreSQL/tests/loadDriverAndConnect.R Mon Oct 19 20:59:30
2009 UTC
+++ /trunk/RPostgreSQL/tests/loadDriverAndConnect.R Sat Feb 8 09:29:04
2014 UTC
@@ -1,4 +1,3 @@
-
## First rough version of a test script
##
## Assumes that
@@ -34,4 +33,6 @@
## and disconnect
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
--- /trunk/RPostgreSQL/tests/loadDriverAndConnect.Rout.save Sat Sep 11
15:56:08 2010 UTC
+++ /trunk/RPostgreSQL/tests/loadDriverAndConnect.Rout.save Sat Feb 8
09:29:04 2014 UTC
@@ -1,7 +1,7 @@
-R version 2.11.1 (2010-05-31)
-Copyright (C) 2010 The R Foundation for Statistical Computing
-ISBN 3-900051-07-0
+R version 3.0.0 (2013-04-03) -- "Masked Marvel"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
@@ -15,7 +15,6 @@
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
->
> ## First rough version of a test script
> ##
> ## Assumes that
@@ -51,5 +50,16 @@
+
+ ## and disconnect
+ dbDisconnect(con)
++ }else{
++ cat("Skip.\n")
+ }
+Loading required package: RPostgreSQL
+Loading required package: DBI
+ datname encoding datallowconn
+1 template0 6 FALSE
+2 template1 6 TRUE
+[1] TRUE
>
+> proc.time()
+ user system elapsed
+ 0.360 0.035 0.387
=======================================
--- /trunk/RPostgreSQL/tests/openSendQuery.R Thu Mar 29 08:07:17 2012 UTC
+++ /trunk/RPostgreSQL/tests/openSendQuery.R Sat Feb 8 09:29:04 2014 UTC
@@ -1,5 +1,4 @@
-
-## dbWriteTable test
+## open send query test
##
## Assumes that
## a) PostgreSQL is running, and
@@ -63,4 +62,6 @@
cat("PASS tmptest disappeared after disconnection\n")
}
dbDisconnect(con)
+}else{
+ cat("Skip.\n")
}
=======================================
***Additional files exist in this changeset.***