[rpostgresql] r272 committed - Remove reference output of tests to avoid too much diff in environmnet...

2 views
Skip to first unread message

rpost...@googlecode.com

unread,
Feb 16, 2014, 12:30:58 AM2/16/14
to rpostgr...@googlegroups.com
Revision: 272
Author: tomo...@kenroku.kanazawa-u.ac.jp
Date: Sun Feb 16 05:30:29 2014 UTC
Log: Remove reference output of tests to avoid too much diff in
environmnet without server
http://code.google.com/p/rpostgresql/source/detail?r=272

Deleted:
/trunk/RPostgreSQL/tests/bytea.Rout.save
/trunk/RPostgreSQL/tests/createTableMixedCaseTest.Rout.save
/trunk/RPostgreSQL/tests/dataTypeTests.Rout.save
/trunk/RPostgreSQL/tests/dateTZ.Rout.save
/trunk/RPostgreSQL/tests/datetimeTests.Rout.save
/trunk/RPostgreSQL/tests/datetimestampwrite.Rout.save
/trunk/RPostgreSQL/tests/dbColumnInfo.Rout.save
/trunk/RPostgreSQL/tests/dbExistsIssue.Rout.save
/trunk/RPostgreSQL/tests/dbExistsq.Rout.save
/trunk/RPostgreSQL/tests/dbExistsqc.Rout.save
/trunk/RPostgreSQL/tests/dbGetQueryParams.Rout.save
/trunk/RPostgreSQL/tests/dbListFields.Rout.save
/trunk/RPostgreSQL/tests/dbTransactionTests.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTableFailTest.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTableSchema.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTableTest.Rout.save
/trunk/RPostgreSQL/tests/dbWriteTabletypes.Rout.save
/trunk/RPostgreSQL/tests/dbtemptable.Rout.save
/trunk/RPostgreSQL/tests/escape.Rout.save
/trunk/RPostgreSQL/tests/loadDriverAndConnect.Rout.save
/trunk/RPostgreSQL/tests/openSendQuery.Rout.save
/trunk/RPostgreSQL/tests/selectWhereZero.Rout.save
/trunk/RPostgreSQL/tests/selectWithAlias.Rout.save
/trunk/RPostgreSQL/tests/unknowntype.Rout.save

=======================================
--- /trunk/RPostgreSQL/tests/bytea.Rout.save Sun Feb 9 12:31:30 2014 UTC
+++ /dev/null
@@ -1,97 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## Test of bytea conversion with insert and retrieve to the db.
-> ##
->
-> 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))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "byteatable"))
-+ dbRemoveTable(con, "byteatable")
-+
-+ sample.object <- list("one", "two");
-+ ser <- serialize(sample.object, NULL, ascii=F);
-+
-+ ## 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")
-+ # don't print the variable binary data in automatic test
-+ # print(postgresqlEscapeBytea(con, ser))
-+ iq <- sprintf("INSERT INTO byteatable values('%s', '%s');", "name1",
postgresqlEscapeBytea(con, ser))
-+ dbGetQuery(con, iq)
-+ rows<-dbGetQuery(con, "SELECT * from byteatable")
-+ ser2<-postgresqlUnescapeBytea(rows[[2]])
-+ if (identical(ser, ser2)) {
-+ cat("PASS: Identical data was recovered\n")
-+ }else{
-+ cat("FAIL: The recovered data is not identical\n")
-+ ser
-+ ser2
-+ }
-+ 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")
-+ # don't print the variable binary data in automatic test
-+ # print(postgresqlEscapeBytea(con, ser))
-+ iq <- sprintf("INSERT INTO byteatable values('%s', '%s');", "name2",
postgresqlEscapeBytea(con, ser))
-+ dbGetQuery(con, iq)
-+ rows<-dbGetQuery(con, "SELECT * from byteatable where name
= 'name2'")
-+ ser3<-postgresqlUnescapeBytea(rows[[2]])
-+ if (identical(ser, ser3)) {
-+ cat("PASS: Identical data was recovered\n")
-+ }else{
-+ cat("FAIL: The recovered data is not identical\n")
-+ ser
-+ ser2
-+ }
-+ dbRemoveTable(con, "byteatable")
-+ 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.
-PASS: Identical data was recovered
-Show encoded string when standard_conforming_strings is off.
-PASS: Identical data was recovered
-DONE
->
-> proc.time()
- user system elapsed
- 0.429 0.035 0.536
=======================================
--- /trunk/RPostgreSQL/tests/createTableMixedCaseTest.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,116 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## createTableMixedCaseTest test
-> ##
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Neil Tiffin, 30 Oct 2009
->
-> ## 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))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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=Sys.getenv("POSTGRES_PORT"))
-+
-+
-+
-+ res <- dbGetQuery(con, "create table Foo1 (f1 int)")
-+ res <- dbGetQuery(con, "create table \"Foo2\" (f1 int)")
-+
-+ cat("Test should create foo1 and Foo2 tables\n")
-+ ## res <- dbGetQuery(con, "SELECT * FROM information_schema.tables
WHERE table_schema = 'public'")
-+ ## print res
-+
-+ if (dbExistsTable(con, "Foo1")) {
-+ cat("FAIL - Foo1 Table exists.\n")
-+ }
-+ else {
-+ cat("Pass - Foo1 Table does not exist.\n")
-+ }
-+
-+ if (dbExistsTable(con, "foo1")) {
-+ cat("Pass - foo1 Table exists.\n")
-+ }
-+ else {
-+ cat("FAIL - foo1 Table does not exist.\n")
-+ }
-+
-+ if (dbExistsTable(con, "Foo2")) {
-+ cat("Pass - Foo2 Table exists.\n")
-+ }
-+ else {
-+ cat("FAIL - Foo2 Table does not exist.\n")
-+ }
-+
-+ if (dbExistsTable(con, "foo2")) {
-+ cat("FAIL - foo2 Table exists.\n")
-+ }
-+ else {
-+ cat("Pass - foo2 Table does not exist.\n")
-+ }
-+
-+ if (dbExistsTable(con, "\"Foo2\"")) {
-+ cat("FAIL - \"Foo2\" Table exists.\n")
-+ }
-+ else {
-+ cat("Pass - \"Foo2\" Table does not exist.\n")
-+ }
-+
-+ if (dbExistsTable(con, "\"foo2\"")) {
-+ cat("FAIL - \"foo2\" Table exists.\n")
-+ }
-+ else {
-+ cat("Pass - \"foo2\" Table does not exist.\n")
-+ }
-+
-+ res <- dbGetQuery(con, "drop table Foo1")
-+ 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.449 0.024 0.506
=======================================
--- /trunk/RPostgreSQL/tests/dataTypeTests.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,148 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## Test of data types, based on earlier version in inst/devTests
-> ##
-> ## Dirk Eddelbuettel, 21 Oct 2008
->
-> 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))
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "tempostgrestable"))
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ ## Test the numeric mapping
-+ dbGetQuery(con, "create table tempostgrestable (intcolumn integer,
floatcolumn float);")
-+
-+ i <- as.integer(10)
-+ j <- as.numeric(56.6)
-+
-+ sql <- paste("insert into tempostgrestable ",
-+ "values (",i, "," ,j ,") ", sep="")
-+ res <- dbGetQuery(con, sql)
-+
-+
-+ dat <- dbReadTable(con, "tempostgrestable")
-+ dbRemoveTable(con, "tempostgrestable")
-+ cat("Read Numeric values\n")
-+
-+ ## now test the types of the colums we got
-+ stopifnot( class(dat[,1]) == "integer" )
-+ stopifnot( class(dat[,2]) == "numeric" )
-+ cat("GOOD -- all numeric types are as expected\n")
-+
-+ ## and test the values
-+ stopifnot( identical( dat[1,1], i))
-+ stopifnot( identical( dat[1,2], j))
-+ cat("GOOD -- all numeric values are as expected\n")
-+
-+ ## Test the logical mapping
-+ if (dbExistsTable(con, "testlogical"))
-+ dbRemoveTable(con, "testlogical")
-+ dbGetQuery(con,"create table testlogical (col1 boolean, col2
boolean)")
-+
-+ i <- as.logical(TRUE)
-+ j <- as.logical(FALSE)
-+
-+ sql <- paste("insert into testlogical ",
-+ "values (",i, "," ,j ,") ", sep="")
-+ res <- dbGetQuery(con, sql);
-+
-+ dat <- dbReadTable(con, "testlogical")
-+ dbRemoveTable(con, "testlogical")
-+ cat("Read Logical values\n")
-+
-+ ## now test the types of the colums we got
-+ stopifnot( class(dat[,1]) == "logical" )
-+ stopifnot( class(dat[,2]) == "logical" )
-+ cat("GOOD -- all logical types are as expected\n")
-+
-+ ## and test the values
-+ stopifnot( identical( dat[1,1], i))
-+ stopifnot( identical( dat[1,2], j))
-+ cat("GOOD -- all logical values are as expected\n")
-+
-+ ## Test the character mapping
-+ if (dbExistsTable(con, "testchar"))
-+ dbRemoveTable(con, "testchar")
-+ dbGetQuery(con,"create table testchar (code char(3),city
varchar(20),country text);")
-+
-+ i <- as.character("IN")
-+ j <- as.character("Hyderabad")
-+ k <- as.character("India")
-+
-+ sql <- paste("insert into testchar ",
-+ "values ('",i,"' , '",j ,"' , '",k,"') ", sep="")
-+ res <- dbGetQuery(con, sql);
-+
-+ dat <- dbReadTable(con, "testchar")
-+ cat("Read Character values\n")
-+
-+ ## now test the types of the colums we got
-+ stopifnot( class(dat[,1]) == "character" )
-+ stopifnot( class(dat[,2]) == "character" )
-+ stopifnot( class(dat[,3]) == "character" )
-+ cat("GOOD -- all character types are as expected\n")
-+
-+ ## and test the values
-+ ##stopifnot( identical( dat[1,1], i))
-+ stopifnot( identical( dat[1,2], j))
-+ stopifnot( identical( dat[1,3], k))
-+ cat("GOOD -- all character values are as expected\n")
-+
-+ dbRemoveTable(con, "testchar")
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ dbDisconnect(con)
-+ 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.035 0.649
=======================================
--- /trunk/RPostgreSQL/tests/dateTZ.Rout.save Sun Feb 9 12:31:30 2014 UTC
+++ /dev/null
@@ -1,186 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## 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")
-+
-+ if (dbExistsTable(con, "tempostgrestable"))
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ dbGetQuery(con, paste("create table tempostgrestable (tt ",
dateclass, ", zz integer);", sep=""))
-+ insstring <- '2008-07-01 14:15:16.123+00'
-+ cat(paste('inserted string 1:', insstring))
-+ cat("\n")
-+ dbGetQuery(con, paste("insert into tempostgrestable values('",
insstring, "', 1);", sep=""))
-+
-+ # now <- ISOdatetime(2000,1,2,3,4,5.678)
-+ insstring <- '2000-01-02 03:04:05.678+00'
-+ cat(paste('inserted string 2:', insstring))
-+ cat("\n")
-+ dbGetQuery(con, paste("insert into tempostgrestable values('",
insstring, "', 2);", sep=""))
-+ 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)
-+
-+ dbGetQuery(con, paste("SET TIMEZONE TO '", tz, "'", sep=""))
-+
-+ data <- dbGetQuery(con, "select tt from tempostgrestable;")
-+
-+ times <- data[,1]
-+ print(times)
-+ if(as.double(tt[1]) == as.double(times[1])){
-+ cat('PASS\n')
-+ }else{
-+ cat('FAIL\n')
-+ }
-+ if(as.double(tt[2]) == as.double(times[2])){
-+ cat('PASS\n')
-+ }else{
-+ cat('FAIL\n')
-+ }
-+
-+
-+ dbRemoveTable(con, "tempostgrestable")
-+ invisible(NULL)
-+ }
-+ cat('testing UTC')
-+ dbTypeTests(con, "timestamp")
-+ dbTypeTests(con, "timestamp with time zone")
-+ cat('testing Asia/Tokyo')
-+ dbTypeTests(con, "timestamp", tz="Asia/Tokyo")
-+ dbTypeTests(con, "timestamp with time zone", tz="Asia/Tokyo")
-+ cat('testing Australlia/South')
-+ dbTypeTests(con, "timestamp", tz="Australia/South")
-+ dbTypeTests(con, "timestamp with time zone", tz="Australia/South")
-+ cat('testing America/New_York')
-+ dbTypeTests(con, "timestamp", tz="America/New_York")
-+ 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.753 0.037 0.982
=======================================
--- /trunk/RPostgreSQL/tests/datetimeTests.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,125 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'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
->
-> ## 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))
-+
-+ dbGetQuery(con, "SET TIMEZONE TO 'UTC'")
-+
-+ dbTypeTests <- function(con, dateclass="timestamp without time zone") {
-+ cat("\n\n**** Trying with ", dateclass, "\n")
-+
-+ if (dbExistsTable(con, "tempostgrestable"))
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ dbGetQuery(con, paste("create table tempostgrestable (tt ",
dateclass, ", zz integer);", sep=""))
-+ dbGetQuery(con, "insert into tempostgrestable values('2008-07-01
14:15:16.123', 1);")
-+
-+ now <- ISOdatetime(2000,1,2,3,4,5.678)
-+ dbGetQuery(con, paste("insert into tempostgrestable values('",
format(now), "', 2);", sep=""))
-+
-+ res <- dbReadTable(con, "tempostgrestable")
-+ print(res)
-+
-+ res <- dbSendQuery(con, "select tt from tempostgrestable;")
-+ data <- fetch(res, n=-1)
-+ print(dbColumnInfo(res))
-+
-+ times <- data[,1]
-+ print(times)
-+ print(class(times[1]))
-+
-+ print(diff(times))
-+
-+ dbRemoveTable(con, "tempostgrestable")
-+ invisible(NULL)
-+ }
-+
-+
-+ 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 14:15:16 1
-2 2000-01-02 03:04:05 2
- name Sclass type len precision scale nullOK
-1 tt POSIXct TIMESTAMPTZOID 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 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.537 0.036 0.768
=======================================
--- /trunk/RPostgreSQL/tests/datetimestampwrite.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,112 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## Test of data types, based on earlier version in inst/devTests
-> ##
-> ## Dirk Eddelbuettel, 21 Oct 2008
->
-> 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))
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "tempostgrestable"))
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ ## Test the numeric mapping
-+ dbGetQuery(con, "create table tempostgrestable (intcolumn date,
floatcolumn timestamp with time zone);")
-+
-+ sql <- paste("insert into tempostgrestable ",
-+ "values ('2011-03-07', '2011-03-07 16:30:39') ")
-+ res <- dbGetQuery(con, sql)
-+
-+ dat <- dbReadTable(con, "tempostgrestable")
-+ dbRemoveTable(con, "tempostgrestable")
-+ cat("Read Date and TIMESTAMP values\n")
-+
-+ ## now test the types of the colums we got
-+ if( class(dat[1,1]) == "Date" ){
-+ cat("PASS -- Date type is as expected\n")
-+ }else{
-+ cat("FAIL -- Date type is other than Date: ")
-+ cat(class(dat[1,1]))
-+ cat("\n")
-+ }
-+ if( class(dat[1,2])[1] == "POSIXct" ){
-+ cat("PASS -- TIMESTAMP is received as POSIXct\n")
-+ }else{
-+ cat("FAIL -- TIMESTAMP is other than POSIXct: ")
-+ cat(class(dat[1,2]))
-+ cat("\n")
-+ }
-+
-+ dbWriteTable(con, "tempostgrestable2", dat)
-+ dat2 <- dbReadTable(con, "tempostgrestable2")
-+ dbRemoveTable(con, "tempostgrestable2")
-+ cat("Check that read after write gets the same data types\n")
-+
-+ ## now test the types of the colums we got
-+ if( class(dat2[1,1]) == "Date" ){
-+ cat("PASS -- Date type is as expected\n")
-+ }else{
-+ cat("FAIL -- Date type is other than Date: ")
-+ cat(class(dat2[1,1]))
-+ cat("\n")
-+ }
-+ if( class(dat2[1,2])[1] == "POSIXct" ){
-+ cat("PASS -- TIMESTAMP is received as POSIXct\n")
-+ }else{
-+ cat("FAIL -- TIMESTAMP is other than POSIXct: ")
-+ cat(class(dat2[1,2]))
-+ cat("\n")
-+ }
-+
-+
-+ dbDisconnect(con)
-+ 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.478 0.031 0.571
=======================================
--- /trunk/RPostgreSQL/tests/dbColumnInfo.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,86 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbColumnInfo test
-> ## Initial report was sporadic segfault (Issue 42)
-> ## and it was found reproducile under gctorture()
-> ## However, test with gctorture() is moved outside the package
-> ## because its execution time is too long.
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ # create a table
-+ dbGetQuery(con, "set client_min_messages to 'WARNING'")
-+ res <- dbGetQuery(con, "CREATE TABLE aa (pk integer primary key, v1
float not null, v2 float)" )
-+
-+ ## 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("dbColumnInfo\n")
-+ print(dbColumnInfo(res))
-+ cat("SELECT result\n")
-+ df <- fetch(res, n=-1)
-+ print(df)
-+
-+ ## cleanup
-+ cat("Removing \"AA\"\n")
-+ dbRemoveTable(con, "aa")
-+ ## and disconnect
-+ dbDisconnect(con)
-+ }else{
-+ cat("Skip.\n")
-+ }
-Loading required package: RPostgreSQL
-Loading required package: DBI
-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
-SELECT result
- pk v1 v2 ?column?
-1 3 2 NA NA
-Removing "AA"
-[1] TRUE
->
-> proc.time()
- user system elapsed
- 0.391 0.039 0.488
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsIssue.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,82 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'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
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ dbWriteTable(con, "rockdata", rock)
-+
-+ ## run a simple dbExists
-+ cat("Does rockdata exist? ")
-+ print(res <- dbExistsTable(con, "rockdata"))
-+
-+ ## this should return TRUE but did not -- does now after patch
-+ cat("Does public.rockdata exist? ")
-+ print(res <- dbExistsTable(con, "public.rockdata"))
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ ## 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.455 0.035 0.536
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsq.Rout.save Sun Feb 9 12:31:30 2014
UTC
+++ /dev/null
@@ -1,87 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'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
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "rock'data")) {
-+ cat("Removing rock'data\n")
-+ dbRemoveTable(con, "rock'data")
-+ }
-+
-+ cat("Write rock'data\n")
-+ dbWriteTable(con, "rock'data", rock)
-+
-+ ## run a simple dbExists
-+ cat("Does rock'data exist? ")
-+ print(res <- dbExistsTable(con, "rock'data"))
-+
-+ ## this should return TRUE but did not -- does now after patch
-+ cat("Does \"public.rock'data\" exist? ")
-+ print(res <- dbExistsTable(con, "public.rock'data"))
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rock'data")) {
-+ cat("Removing rock'data\n")
-+ dbRemoveTable(con, "rock'data")
-+ }
-+
-+ ## 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.456 0.037 0.543
=======================================
--- /trunk/RPostgreSQL/tests/dbExistsqc.Rout.save Sun Feb 9 12:31:30 2014
UTC
+++ /dev/null
@@ -1,130 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'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
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "rock.data")) {
-+ cat("Removing rock'data\n")
-+ dbRemoveTable(con, "rock.data")
-+ }
-+
-+
-+ dbWriteTable(con, "rock.data", rock)
-+ ## run a simple dbExists
-+ cat("Does rock.data exist? \n")
-+ res <- dbExistsTable(con, "rock.data")
-+ if(res){
-+ cat("PASS: true\n")
-+ }else{
-+ cat("FAIL: false\n")
-+ }
-+
-+ ##
-+ cat("create schema testschema and change the search_path\n")
-+
-+ dbGetQuery(con, 'CREATE SCHEMA testschema')
-+ dbGetQuery(con, 'SET search_path TO testschema')
-+ cat("Does rock.data exist? \n")
-+ res <- dbExistsTable(con, "rock.data")
-+ if(res){
-+ cat("FAIL: true despite search_path change\n")
-+ }else{
-+ cat("PASS: false as the search_path changed\n")
-+ }
-+
-+ cat("Does testschema.\"rock.data\" exist? \n")
-+ res <- dbExistsTable(con, c('testschema', "rock.data"))
-+ if(res){
-+ cat("FAIL: true despite testschema specified\n")
-+ }else{
-+ cat("PASS: false as the testschema specified\n")
-+ }
-+
-+ cat("Does public.\"rock.data\" exist? \n")
-+ res <- dbExistsTable(con, c('public', "rock.data"))
-+ if(res){
-+ cat("PASS: true despite search_path change\n")
-+ }else{
-+ cat("FAIL: false as the search_path changed\n")
-+ }
-+
-+
-+ cat("write in current schema\n")
-+ dbWriteTable(con, "rock.data", rock)
-+ cat("Does rock.data exist? \n")
-+ res <- dbExistsTable(con, "rock.data")
-+ if(res){
-+ cat("PASS: true\n")
-+ }else{
-+ cat("FAIL: false\n")
-+ }
-+
-+ ## cleanup
-+ dbGetQuery(con, 'DROP TABLE "public"."rock.data"')
-+ dbGetQuery(con, 'DROP TABLE "testschema"."rock.data"')
-+ dbGetQuery(con, 'DROP schema "testschema"')
-+
-+ ## 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.533 0.033 0.671
=======================================
--- /trunk/RPostgreSQL/tests/dbGetQueryParams.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,93 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbGetQuery test with optional parameters
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ dbWriteTable(con, "rockdata", rock)
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "SELECT * FROM rockdata WHERE peri > $1 LIMIT
10", 4000)
-+ print(res)
-+ res <- dbGetQuery(con, "SELECT * FROM rockdata WHERE peri > $1 AND
shape < $2 LIMIT $3", c(4000, 0.2, 10))
-+ print(res)
-+
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ ## 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.444 0.028 0.560
=======================================
--- /trunk/RPostgreSQL/tests/dbListFields.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,88 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbListFields test
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
->
-> ## 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))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ # create a table
-+ res <- dbGetQuery(con, "CREATE SCHEMA testschema")
-+ res <- dbGetQuery(con, "CREATE TABLE testschema.aa (pid integer,
name text)")
-+ res <- dbGetQuery(con, "CREATE TABLE aa (pk integer, v1 float not
null, v2 float)" )
-+
-+ ## run a simple query and show the query result
-+ df <- dbListFields(con, "aa")
-+ print(df)
-+ if (length(df) == 3){
-+ cat("PASS: 3 fields returned\n")
-+ }else{
-+ cat(paste("FAIL:", length(df), "fields returned\n"))
-+ }
-+
-+ df <- dbListFields(con, c("testschema", "aa"))
-+ print(df)
-+ if (length(df) == 2){
-+ cat("PASS: 2 fields returned\n")
-+ }else{
-+ cat(paste("FAIL:", length(df), "fields returned\n"))
-+ }
-+
-+
-+ ## cleanup
-+ cat("Removing \"AA\"\n")
-+ dbRemoveTable(con, "aa")
-+ dbGetQuery(con, "DROP TABLE testschema.aa")
-+ 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.421 0.034 0.510
=======================================
--- /trunk/RPostgreSQL/tests/dbTransactionTests.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,131 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## Transaction test using two connections
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## create two independent connections
-+ con1 <- 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))
-+
-+ con2 <- 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))
-+
-+
-+ if (dbExistsTable(con1, "rockdata")) {
-+ cat("Removing rockdata\n")
-+ dbRemoveTable(con1, "rockdata")
-+ }
-+
-+ cat("begin transaction in con1\n")
-+ dbGetQuery(con1, "BEGIN TRANSACTION")
-+ cat("create table rockdata in con1\n")
-+ dbWriteTable(con1, "rockdata", rock)
-+ if (dbExistsTable(con1, "rockdata")) {
-+ cat("PASS rockdata is visible through con1\n")
-+ }else{
-+ cat("FAIL rockdata is invisible through con1\n")
-+ }
-+ if (dbExistsTable(con2, "rockdata")) {
-+ cat("FAIL rockdata is visible through con2\n")
-+ }else{
-+ cat("PASS rockdata is invisible through con2\n")
-+ }
-+ cat("commit in con1\n")
-+ dbCommit(con1)
-+ if (dbExistsTable(con2, "rockdata")) {
-+ cat("PASS rockdata is visible through con2\n")
-+ }else{
-+ cat("FAIL rockdata is invisible through con2\n")
-+ }
-+
-+ cat("remove the table from con1\n")
-+ dbRemoveTable(con1, "rockdata")
-+
-+ if (dbExistsTable(con2, "rockdata")) {
-+ cat("FAIL rockdata is visible through con2\n")
-+ }else{
-+ cat("PASS rockdata is invisible through con2\n")
-+ }
-+
-+ cat("begin transaction in con1\n")
-+ dbGetQuery(con1, "BEGIN TRANSACTION")
-+ cat("create table rockdata in con1\n")
-+ dbWriteTable(con1, "rockdata", rock)
-+ if (dbExistsTable(con1, "rockdata")) {
-+ cat("PASS rockdata is visible through con1\n")
-+ }else{
-+ cat("FAIL rockdata is invisible through con1\n")
-+ }
-+ cat("RollBack con1\n")
-+ dbRollback(con1)
-+ if (dbExistsTable(con1, "rockdata")) {
-+ cat("FAIL rockdata is visible through con1\n")
-+ }else{
-+ cat("PASS rockdata is invisible through con1\n")
-+ }
-+
-+ ## 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.553 0.032 0.749
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableFailTest.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,108 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbWriteTable fail test
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+ cat("create incompatible table rockdata\n")
-+ dbGetQuery(con, "CREATE TABLE rockdata (a int, b varchar(5))")
-+
-+ cat("write table to rockdata with append=TRUE\n")
-+ try({res <-dbWriteTable(con, 'rockdata', rock, append=TRUE,
overwrite=FALSE)
-+ print(res)
-+ if(res == FALSE){
-+ cat("PASS as the return value is false\n")
-+ }else{
-+ cat("FAIL as the return value is true\n")
-+ }
-+ })
-+
-+ cat("write table to rockdata\n")
-+ try({res <- dbWriteTable(con, 'rockdata', rock)
-+ if(res == FALSE){
-+ print(res)
-+ cat("PASS as the return value is false\n")
-+ }else{
-+ cat("FAIL as the return value is true\n")
-+ }
-+ })
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "select * from rockdata limit 10")
-+ print(res)
-+
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ ## 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.450 0.024 0.492
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableSchema.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,87 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbWriteTable test
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, c("public", "rockdata"))) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, c("public", "rockdata"))
-+ }
-+
-+ dbWriteTable(con, c("public", "rockdata"), rock)
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "select * from public.rockdata limit 10")
-+ print(res)
-+
-+
-+ ## cleanup
-+ if (dbExistsTable(con, c("public", "rockdata"))) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, c("public", "rockdata"))
-+ }
-+
-+ ## 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.434 0.029 0.518
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTableTest.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,98 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbWriteTable test with append=T
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ dbWriteTable(con, "rockdata", rock[1:5,])
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "select * from rockdata limit 10")
-+ print(res)
-+
-+ dbWriteTable(con, "rockdata", rock[6:15,], append=T)
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "select * from rockdata limit 10")
-+ print(res)
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ ## 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.488 0.040 0.626
=======================================
--- /trunk/RPostgreSQL/tests/dbWriteTabletypes.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,288 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbWriteTable test with various types
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ dbGetQuery(con, "set client_encoding to 'UTF-8'")
-+ difficultstrings <- c("normal", "t\tab", "v\vertical
tab", "n\newline", "r carriage \retern", "back \\ slash", "f\form feed")
-+ df <- data.frame(strings=difficultstrings)
-+
-+ dbWriteTable(con, "rockdata", df)
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "select * from rockdata")
-+ print(res)
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+
-+ difficultstringe <- c("normal", "m\u00fc\u00df")
-+ df <- data.frame(strings=difficultstringe)
-+ tryres <- try({dbWriteTable(con, "rockdata", df)
-+ res <- dbGetQuery(con, "select * from rockdata")
-+ for(n in 1:2){
-+ cat(paste(as.character(n), "\t"))
-+ cat(res[n,2])
-+ cat("\n")
-+ }
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ })
-+ if(tryres != TRUE){
-+ cat("FAIL: could not write small umlaut u and ligature sz.\n")
-+ cat(" This might be no problem for you if you don't use
those special characters.\n")
-+ cat(" Otherwise, please check for the server encoding.\n")
-+ cat(" Database encoding is usually set at the time of
createdb.\n")
-+ cat(" You can see for more information on how to setup at
\n")
-+ cat("
http://www.postgresql.org/docs/9.1/static/multibyte.html\n\n")
-+ }else{
-+ cat("PASS: could write small umlaut u and ligature sz\n")
-+ }
-+
-+ difficultstringk <- c("normal", "kanji\u6f22\u5b57")
-+ df <- data.frame(strings=difficultstringk)
-+ tryres <- try({dbWriteTable(con, "rockdata", df)
-+ res <- dbGetQuery(con, "select * from rockdata")
-+ for(n in 1:2){
-+ cat(paste(as.character(n), "\t"))
-+ cat(res[n,2])
-+ cat("\n")
-+ }
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ })
-+ if(tryres != TRUE){
-+ cat("FAIL: could not write kanji.\n")
-+ cat(" This might be no problem for you if you don't use
multibyte characters.\n")
-+ cat(" Otherwise, please check for the server encoding.\n")
-+ cat(" Database encoding is usually set at the time of
createdb.\n")
-+ cat(" You can see for more information on how to setup at
\n")
-+ cat("
http://www.postgresql.org/docs/9.1/static/multibyte.html\n\n")
-+ }else{
-+ cat("PASS: could write kanji\n")
-+ }
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ if (dbExistsTable(con, "tempostgrestable"))
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ ## Test the numeric mapping
-+ dbGetQuery(con, "create table tempostgrestable (intcolumn integer,
floatcolumn float);")
-+
-+ i <- as.integer(10)
-+ j <- as.numeric(56.6)
-+
-+ sql <- paste("insert into tempostgrestable ",
-+ "values (",i, "," ,j ,") ", sep="")
-+ res <- dbGetQuery(con, sql)
-+
-+ dat <- dbReadTable(con, "tempostgrestable")
-+ dbRemoveTable(con, "tempostgrestable")
-+ res <- dbWriteTable(con, "numerictable", dat)
-+ dat <- dbReadTable(con, "numerictable")
-+ dbRemoveTable(con, "numerictable")
-+ cat("Read Numeric values\n")
-+
-+ ## now test the types of the colums we got
-+ if( class(dat[,1]) == "integer" ) {
-+ cat("PASS -- all integer is as expected\n")
-+ }else{
-+ cat(paste("FAIL -- an integer became ", class(dat[,1]), "\n"))
-+ }
-+ stopifnot( class(dat[,2]) == "numeric" )
-+
-+ ## and test the values
-+ if( identical( dat[1,1], i)){
-+ cat("PASS integer value is preserved")
-+ }else{
-+ cat(paste("FAIL:", i, "changed to", dat[1,1], "\n"))
-+ }
-+ stopifnot( identical( dat[1,2], j))
-+ cat("GOOD -- all numeric values are as expected\n")
-+
-+ ## Test the logical mapping
-+ if (dbExistsTable(con, "testlogical"))
-+ dbRemoveTable(con, "testlogical")
-+ dbGetQuery(con,"create table testlogical (col1 boolean, col2
boolean)")
-+
-+ i <- as.logical(TRUE)
-+ j <- as.logical(FALSE)
-+
-+ sql <- paste("insert into testlogical ",
-+ "values (",i, "," ,j ,") ", sep="")
-+ res <- dbGetQuery(con, sql);
-+
-+ dat <- dbReadTable(con, "testlogical")
-+ res <- dbWriteTable(con, "logicaltable", dat)
-+ dbRemoveTable(con, "testlogical")
-+ dat2 <- dbReadTable(con,"logicaltable")
-+ dbRemoveTable(con, "logicaltable")
-+ cat("Read Logical values\n")
-+
-+ ## now test the types of the colums we got
-+ stopifnot( class(dat2[,1]) == "logical" )
-+ stopifnot( class(dat2[,2]) == "logical" )
-+ cat("GOOD -- all logical types are as expected\n")
-+
-+ ## and test the values
-+ stopifnot( identical( dat2[1,1], i))
-+ stopifnot( identical( dat2[1,2], j))
-+ cat("GOOD -- all logical values are as expected\n")
-+
-+ ## Test the character mapping
-+ if (dbExistsTable(con, "testchar"))
-+ dbRemoveTable(con, "testchar")
-+ dbGetQuery(con,"create table testchar (code char(3),city
varchar(20),country text);")
-+
-+ i <- as.character("IN")
-+ j <- as.character("Hyderabad")
-+ k <- as.character("India")
-+
-+ sql <- paste("insert into testchar ",
-+ "values ('",i,"' , '",j ,"' , '",k,"') ", sep="")
-+ res <- dbGetQuery(con, sql);
-+
-+ dat <- dbReadTable(con, "testchar")
-+ dbRemoveTable(con, "testchar")
-+ dbWriteTable(con, "testchar", dat)
-+ dat <- dbReadTable(con, "testchar")
-+ cat("Read Character values\n")
-+
-+ ## now test the types of the colums we got
-+ stopifnot( class(dat[,1]) == "character" )
-+ stopifnot( class(dat[,2]) == "character" )
-+ stopifnot( class(dat[,3]) == "character" )
-+ cat("GOOD -- all character types are as expected\n")
-+
-+ ## and test the values
-+ ##stopifnot( identical( dat[1,1], i))
-+ stopifnot( identical( dat[1,2], j))
-+ stopifnot( identical( dat[1,3], k))
-+ cat("GOOD -- all character values are as expected\n")
-+
-+ dbRemoveTable(con, "testchar")
-+ dbRemoveTable(con, "tempostgrestable")
-+
-+ ## Test the numeric mapping
-+ dbGetQuery(con, "create table tempostgrestable (intcolumn date,
floatcolumn timestamp with time zone);")
-+
-+ sql <- paste("insert into tempostgrestable ",
-+ "values ('2011-03-07', '2011-03-07 16:30:39') ")
-+ res <- dbGetQuery(con, sql)
-+
-+ dat <- dbReadTable(con, "tempostgrestable")
-+ dbRemoveTable(con, "tempostgrestable")
-+ dbWriteTable(con, "tempostgrestable2", dat)
-+ dat2 <- dbReadTable(con, "tempostgrestable2")
-+ dbRemoveTable(con, "tempostgrestable2")
-+ cat("Check that read after write gets the same data types\n")
-+
-+ ## now test the types of the colums we got
-+ if( class(dat2[1,1]) == "Date" ){
-+ cat("PASS -- Date type is as expected\n")
-+ }else{
-+ cat("FAIL -- Date type is other than Date: ")
-+ cat(class(dat2[1,1]))
-+ cat("\n")
-+ }
-+ if( class(dat2[1,2])[1] == "POSIXct" ){
-+ cat("PASS -- TIMESTAMP is received as POSIXct\n")
-+ }else{
-+ cat("FAIL -- TIMESTAMP is other than POSIXct: ")
-+ cat(class(dat2[1,2]))
-+ cat("\n")
-+ }
-+
-+
-+ dbDisconnect(con)
-+ 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
-1 normal
-2 kanji漢字
-[1] "Removing rockdata\n"
-PASS: could write kanji
-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
- 1.053 0.046 1.580
=======================================
--- /trunk/RPostgreSQL/tests/dbtemptable.Rout.save Sun Feb 9 12:31:30 2014
UTC
+++ /dev/null
@@ -1,73 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## dbtemplate test
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+
-+ a <- dbGetQuery(con, "CREATE TABLE foo (name text)")
-+ b <- dbGetQuery(con, "INSERT INTO foo VALUES ('bar')")
-+
-+ ## run a simple query and show the query result
-+ x <- dbSendQuery(con, "CREATE TEMPORARY TABLE xyz ON COMMIT DROP AS
select * from foo limit 1; select * from xyz;")
-+ res <- fetch(x, n=-1)
-+ print(res)
-+ a <- dbGetQuery(con, "DROP TABLE foo")
-+
-+
-+ ## cleanup
-+
-+ ## 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.394 0.027 0.482
=======================================
--- /trunk/RPostgreSQL/tests/escape.Rout.save Sun Feb 9 12:31:30 2014 UTC
+++ /dev/null
@@ -1,76 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## escape test
-> ##
-> ## this tests for proper escaping of SQL special characters
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 03 Oct 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## 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
-+ 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("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)
-+ dbGetQuery(con, "set standard_conforming_strings to 'on'")
-+ st3 <- (postgresqlEscapeStrings(con,"aa\\a"))
-+ print(st3)
-+ dbGetQuery(con, "set standard_conforming_strings to 'off'")
-+ st4 <- (postgresqlEscapeStrings(con,"aa\\a"))
-+ print(st4)
-+
-+ ## 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] "aa\\\\a"
-[1] TRUE
->
-> proc.time()
- user system elapsed
- 0.363 0.032 0.385
=======================================
--- /trunk/RPostgreSQL/tests/loadDriverAndConnect.Rout.save Sun Feb 9
12:31:30 2014 UTC
+++ /dev/null
@@ -1,65 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## First rough version of a test script
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 02 Jul 2008
-> ## 21 Oct 2008 make conditional on environment
variables
->
-> ## 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))
-+
-+ ## 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))
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, paste("select datname,encoding,datallowconn
from pg_database",
-+ "where datname like 'template%' order
by datname"))
-+ print(res)
-+
-+ ## 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.367 0.028 0.407
=======================================
--- /trunk/RPostgreSQL/tests/openSendQuery.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,96 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## open send query test
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 10 Sep 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## create two independent connections
-+ 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))
-+
-+ if (dbExistsTable(con, "tmptest")) {
-+ cat("Removing tmptest\n")
-+ dbRemoveTable(con, "tmptest")
-+ }
-+ # create temporary table (as a copy of any existing one)
-+ # dbGetQuery(con, "BEGIN TRANSACTION")
-+ cat("create temp table tmptest with dbGetQuery\n")
-+ dbGetQuery(con, "CREATE TEMP TABLE tmptest (f1 int)")
-+
-+ # query temp table
-+ rs<-dbGetQuery(con, "SELECT * from tmptest")
-+ print(rs)
-+
-+ cat("create temp table tmptest with dbSendQuery\n")
-+ dbSendQuery(con, "CREATE TEMP TABLE tmptest2(f2 int)")
-+
-+ # query temp table
-+ rs2<-dbGetQuery(con, "SELECT * from tmptest2")
-+ print(rs2)
-+ ## and disconnect
-+ dbDisconnect(con)
-+
-+ 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))
-+
-+ if (dbExistsTable(con, "tmptest")) {
-+ cat("FAIL tmptest persisted after disconnection\n")
-+ cat("Removing tmptest\n")
-+ dbRemoveTable(con, "tmptest")
-+ }else{
-+ cat("PASS tmptest disappeared after disconnection\n")
-+ }
-+ dbDisconnect(con)
-+ }else{
-+ cat("Skip.\n")
-+ }
-Loading required package: RPostgreSQL
-Loading required package: DBI
-create temp table tmptest with dbGetQuery
-data frame with 0 columns and 0 rows
-create temp table tmptest with dbSendQuery
-data frame with 0 columns and 0 rows
-PASS tmptest disappeared after disconnection
-[1] TRUE
->
-> proc.time()
- user system elapsed
- 0.410 0.033 0.458
=======================================
--- /trunk/RPostgreSQL/tests/selectWhereZero.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,90 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## selectWhereZero test
-> ##
-> ## test for the 'Issue 6' on the Google Code issue log
-> ## Buffer overflow when numeric condition is given for a character
variable
-> ## Issue 19 is also on this test script.
-> ##
-> ## This test script appeared at r111 by dirk.eddelbuettel on Oct 9, 2009
-> ##
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, "tmpirisdata")) {
-+ print("Removing tmpirisdata\n")
-+ dbRemoveTable(con, "tmpirisdata")
-+ }
-+
-+ dbWriteTable(con, "tmpirisdata", iris)
-+
-+ ## run a simple query and show the query result
-+ cat("Testing if erroneous SQL cause normal error without
segmentation fault.\n")
-+
-+ res <- dbGetQuery(con, "select * from tmpirisdata where
\"Species\"=0")
-+ print(res)
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "tmpirisdata")) {
-+ print("Removing tmpirisdata\n")
-+ dbRemoveTable(con, "tmpirisdata")
-+ }
-+
-+ ## and disconnect
-+ dbDisconnect(con)
-+ cat("PASS: reached to the end of the test code without segmentation
fault\n")
-+ ## this test is success if we reach here regardless of any other
message
-+ }else{
-+ cat("Skip.\n")
-+ }
-Loading required package: RPostgreSQL
-Loading required package: DBI
-Testing if erroneous SQL cause normal error without segmentation fault.
-Error in postgresqlExecStatement(conn, statement, ...) :
- RS-DBI driver: (could not Retrieve the result : ERROR: operator does
not exist: text = integer
-LINE 1: select * from tmpirisdata where "Species"=0
- ^
-HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
-)
-NULL
-[1] "Removing tmpirisdata\n"
-PASS: reached to the end of the test code without segmentation fault
-Warning message:
-In postgresqlQuickSQL(conn, statement, ...) :
- Could not create execute: select * from tmpirisdata where "Species"=0
->
-> proc.time()
- user system elapsed
- 0.448 0.031 0.525
=======================================
--- /trunk/RPostgreSQL/tests/selectWithAlias.Rout.save Sun Feb 9 12:31:30
2014 UTC
+++ /dev/null
@@ -1,88 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## selectWithAlias test
-> ##
-> ## test for the 'Issue 1' on the Google Code issue log
-> ## this was reported in June and fixed by Joe Conway (svr committ r100)
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 03 Oct 2009
->
-> ## 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))
-+ stopifnot(require(datasets))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ dbWriteTable(con, "rockdata", rock)
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "select area as ar, peri as pe, shape as sh,
perm as pr from rockdata limit 10")
-+ print(res)
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "rockdata")) {
-+ print("Removing rockdata\n")
-+ dbRemoveTable(con, "rockdata")
-+ }
-+
-+ ## and disconnect
-+ dbDisconnect(con)
-+ }else{
-+ cat("Skip.\n")
-+ }
-Loading required package: RPostgreSQL
-Loading required package: DBI
- ar pe sh pr
-1 4990 2791.90 0.0903296 6.3
-2 7002 3892.60 0.1486220 6.3
-3 7558 3930.66 0.1833120 6.3
-4 7352 3869.32 0.1170630 6.3
-5 7943 3948.54 0.1224170 17.1
-6 7979 4010.15 0.1670450 17.1
-7 9333 4345.75 0.1896510 17.1
-8 8209 4344.75 0.1641270 17.1
-9 8393 3682.04 0.2036540 119.0
-10 6425 3098.65 0.1623940 119.0
-[1] "Removing rockdata\n"
-[1] TRUE
->
-> proc.time()
- user system elapsed
- 0.437 0.034 0.532
=======================================
--- /trunk/RPostgreSQL/tests/unknowntype.Rout.save Sun Feb 9 12:31:30 2014
UTC
+++ /dev/null
@@ -1,92 +0,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.
-Type 'license()' or 'licence()' for distribution details.
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> ## unknowntype test
-> ##
-> ## test for
-> ## Issue 5 comment #12
-> ## on the Google Code issue log
-> ##
-> ## Assumes that
-> ## a) PostgreSQL is running, and
-> ## b) the current user can connect
-> ## both of which are not viable for release but suitable while we test
-> ##
-> ## Dirk Eddelbuettel, 03 Oct 2009
->
-> ## 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))
-+
-+ ## load the PostgresSQL driver
-+ drv <- dbDriver("PostgreSQL")
-+
-+ ## 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))
-+
-+
-+ if (dbExistsTable(con, "tmpirisdata")) {
-+ print("Removing tmpirisdata\n")
-+ dbRemoveTable(con, "tmpirisdata")
-+ }
-+
-+
-+ ## run a simple query and show the query result
-+ res <- dbGetQuery(con, "create table tmpirisdata (ra REAL[])")
-+ res <- dbSendQuery(con, "select ra from tmpirisdata")
-+ cat("Note connection handle will change every time\n")
-+ # connection data are variable, so don't print
-+ # print(res)
-+ type <- dbColumnInfo(res)
-+ print(type)
-+ data <- fetch(res, -1)
-+ print(data)
-+
-+ ## cleanup
-+ if (dbExistsTable(con, "tmpirisdata")) {
-+ print("Removing tmpirisdata\n")
-+ dbRemoveTable(con, "tmpirisdata")
-+ }
-+
-+ ## 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
-Note connection handle will change every time
- name Sclass type len precision scale nullOK
-1 ra character UNKNOWN -1 -1 -1 TRUE
-data frame with 0 columns and 0 rows
-[1] "Removing tmpirisdata\n"
-PASS: reached to the end of the test code without segmentation fault
-Warning message:
-In postgresqlDescribeFields(res, ...) :
- RS-DBI driver warning: (unknown (1021))
->
-> proc.time()
- user system elapsed
- 0.417 0.035 0.492
Reply all
Reply to author
Forward
0 new messages