Skip to content

Commit

Permalink
version 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomoaki Nishiyama authored and cran-robot committed Jul 27, 2021
1 parent 0e9b0cf commit f862fe6
Show file tree
Hide file tree
Showing 28 changed files with 2,706 additions and 2,237 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
@@ -1,3 +1,13 @@
2021-07-26 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
* Change LICENCE to GPL-3
* import new config.guess and config.sub
* Drop an unused variable RS_PostgreSQL_closeManager_t
* Use seq_along() instead of seq(along=)
* -Wno-stringop-truncation for libpq compilation on windows
* Change Description for new version and license.
* fix type as pointed out by PR #109
* http to https transition for URLs

2017-06-19 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>
* new libpq from postgresql-9.6.3 and Makefiles generated on Sierra (macOS 10.12)

Expand Down
12 changes: 6 additions & 6 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: RPostgreSQL
Version: 0.6-2
Date: 2017-06-24
Version: 0.7
Date: 2021-07-26
Title: R Interface to the 'PostgreSQL' Database System
Author: Joe Conway, Dirk Eddelbuettel, Tomoaki Nishiyama, Sameer Kumar Prayaga (during 2008), Neil Tiffin
Maintainer: Tomoaki Nishiyama <tomoakin@staff.kanazawa-u.ac.jp>
Expand All @@ -14,14 +14,14 @@ Description: Database interface and 'PostgreSQL' driver for 'R'.
On 'macOS' and 'Microsoft Windows' system the attached 'libpq' library source will be used.
LazyLoad: true
Depends: R (>= 2.9.0), methods, DBI (>= 0.3)
License: GPL-2 | file LICENSE
License: GPL-3 | file LICENSE
Copyright: Authors listed above, PostgreSQL Global Development Group,
and The Regents of the University of California
Collate: S4R.R zzz.R PostgreSQLSupport.R dbObjectId.R PostgreSQL.R
URL: https://github.com/tomoakin/RPostgreSQL,
https://cran.r-project.org/package=DBI,
http://www.postgresql.org
https://www.postgresql.org
NeedsCompilation: yes
Packaged: 2017-06-24 03:16:20 UTC; tomoaki
Packaged: 2021-07-27 07:28:13 UTC; tomoaki
Repository: CRAN
Date/Publication: 2017-06-24 07:17:52 UTC
Date/Publication: 2021-07-27 09:00:01 UTC
10 changes: 6 additions & 4 deletions LICENSE
@@ -1,12 +1,14 @@
This package as a whole is distributed under GPL-2 (GNU GENERAL PUBLIC LICENSE
version 2). See the file COPYING in the top level of the R directory
This package as a whole is distributed under GPL-3 (GNU GENERAL PUBLIC LICENSE
version 3). See the file COPYING in the top level of the R directory
tree for further details.

The files under src/libpq/ and libpq.dll are distributed under the
PostgreSQL License (see below). That is, if you take only that part out of the
package you may redistribute only under the restriction of
PostgreSQL License. Most of this package are distributed under GPL-2
and if you redistribute any part of this, you must follow GPL-2.
PostgreSQL License.
Most of this package are distributed under GPL-2|GPL-3.
But now that, new versions of config.guess and config.sub are under GPL-3,
the whole should be handled as GPL-3.

PostgreSQL License:
PostgreSQL Database Management System
Expand Down
52 changes: 27 additions & 25 deletions MD5
@@ -1,15 +1,15 @@
dc80c3a9e2d8ca998eab0e2fec8471ac *ChangeLog
a3ff2822d849dacb3193b16f30fc4f4d *DESCRIPTION
c8af6d9e6bc5bf68e12a361ef92d8ed2 *LICENSE
7ae4d57e0fee8bde38ca99d84dd5d09c *ChangeLog
d20c7b51242617cbf491e795f3f509dc *DESCRIPTION
532949fe6f8ba0bcd380ecdc746d28d4 *LICENSE
ef67e1a6b6119ab1e5c8ef1a91d67304 *NAMESPACE
eeb697c8142a3ae9d80089a524196a4e *R/PostgreSQL.R
0169b9bef554392a042991e592d2f618 *R/PostgreSQLSupport.R
71b52ea06eff008cc9908464e4ca8ca5 *R/PostgreSQLSupport.R
7d7c6c93167e88df8801f1faef732672 *R/S4R.R
0972c665e3149619a32f3b4d30528e0f *R/dbObjectId.R
e186b6a39b159fc324e46e782b409e81 *R/zzz.R
4b5e59c53d38086590d8d8553853ab04 *cleanup
9f62cea643b3db002dbd706250c80fb4 *configure
ebc16444d2e211aef7515101f8627ec3 *configure.in
30b440dd371541de7d9a4938da291580 *configure
f7ce88eba008d71a37f2a187db25f817 *configure.ac
d41d8cd98f00b204e9800998ecf8427e *configure.win
b5dc804b1235adfa8c8a310b052420fe *inst/ANNOUNCEMENT
946c54d9e826b3a9420e1e572a228773 *inst/NEWS
Expand All @@ -23,11 +23,11 @@ b42cfbf562a28612beb8acfe0f716c61 *inst/devTests/demo.r
0cda913b0e5e9141de5ee02ce25bff4d *inst/devTests/timeTypeComparison.r
5c86f87f1eb660bf799f2a6e49e75175 *inst/devTests/transactionManagement.r
cb8f0f0ce13da24f66f2ac2422cdbc01 *inst/devTests/typeTest.r
2bacf1f535842960fc48d82481ec3a64 *man/PostgreSQL.Rd
a682740559434b0be0182347cd19d5a5 *man/PostgreSQLConnection-class.Rd
0c1f3f1574eb65bb535771cdf1445264 *man/PostgreSQLDriver-class.Rd
e8f24a49034c617587474bd9184f4c28 *man/PostgreSQLObject-class.Rd
fb8d66f2760e85ca9feb85e662b82d4b *man/PostgreSQLResult-class.Rd
40a980c0dcb2a2e7bf7b621d58b97a21 *man/PostgreSQL.Rd
f2df03e4d0c6464f2d16c33db8f0d3de *man/PostgreSQLConnection-class.Rd
dab38dd56d13abc8c255b472dd5dc9bc *man/PostgreSQLDriver-class.Rd
dc448e52d270f4c99a942f0a2d4577e6 *man/PostgreSQLObject-class.Rd
92e0fe6c812d4c177dc535afdd6d0dff *man/PostgreSQLResult-class.Rd
78a38a9a8bcbb702d481059eac7a0bc9 *man/S4R.Rd
3e68a0f8c848180ee037246fb4d70796 *man/dbApply-methods.Rd
03b366bccc90c81553c337f03b174e18 *man/dbApply.Rd
Expand All @@ -39,7 +39,7 @@ d68ccaec06323011e2cdbe2fb6ba53be *man/dbCommit-methods.Rd
672686099929bc9cfd9e266564c4e3b1 *man/dbGetInfo-methods.Rd
4bb31b1d603e5d6044581d6f51bee7a8 *man/dbListTables-methods.Rd
e5dcc62d043e378ffdb08cea2843811f *man/dbObjectId-class.Rd
62d0695540c2a3753b1f9b175415e850 *man/dbReadTable-methods.Rd
afe2c2500518e1e55985ab2881915163 *man/dbReadTable-methods.Rd
7ea294d032c6a55b22a92273f0dcc7c7 *man/dbSendQuery-methods.Rd
2848a5fcf92bbfdadd1aaa0aca55dc75 *man/dbSetDataMappings-methods.Rd
83f1f8b189e59d0706e5bb0fd36aeeae *man/fetch-methods.Rd
Expand All @@ -50,28 +50,28 @@ efefe77c91468729e7f3f44d2baa9e96 *man/postgresqlDBApply.Rd
3d83d9d767377bbcf86e4a8a3eddfef6 *man/postgresqlSupport.Rd
1fa83980e75922372ce35309a6d37ab7 *man/summary-methods.Rd
d6e06acf69eb5a72bba126285917aeab *src/Makevars.in
28b4fca3fd3ae85de4b1d1bb480c0837 *src/Makevars.win
2c921023feef2ae3cc4188e50d5daf71 *src/Makevars.win
7325202e43db237b774cc23c050eca73 *src/RS-DBI.c
236716a8af15777a481749919a8f6bfb *src/RS-DBI.h
b8d8232a7427a51cb16c50d081d21232 *src/RS-PQescape.c
57f42efb0442ff8d2fb25d027170bfda *src/RS-PostgreSQL.c
88f09d74dc45e8983713244cc9cb588f *src/RS-PostgreSQL.c
6c0be5883afe2ace76eed7703082a8ca *src/RS-PostgreSQL.h
5df3c99d1b8eab419931022192c77adc *src/RS-pgsql-copy.c
cfa2bbf92907b75535c315700f649fa3 *src/RS-pgsql-getResult.c
a547c0234e7b3b7579d165f0fae983ed *src/RS-pgsql-pqexec.c
922b7ac83d448307f3e72dafc0e8ae03 *src/RS-pgsql-pqexecparams.c
f771f6396b3fc2a9d7dbfd91a776ca17 *src/S4R.h
cd97f90bb8f96381bc90618f20f92e37 *src/config.guess
1909cacd8bdd9e8b01df53649a497e74 *src/config.sub
905d6eb670fdd56244581a03fed76104 *src/S4R.h
c64564b7c7563dae5ebe016f340c9cd9 *src/config.guess
d320a9a1a5eb63901563ae5adf268433 *src/config.sub
d41d8cd98f00b204e9800998ecf8427e *src/install-sh
ef344a9f1740fa86ca1465e306fc30bf *src/libpq/COPYRIGHT
eb7275b692da0783d3fa79f9e7ae7e1a *src/libpq/Makefile.darwin
7c4433575a34e6077f2332c6401c4ceb *src/libpq/Makefile.global.darwin
952695047f55635fd38656b147ed2643 *src/libpq/Makefile.global.win32
abb87cd2b4bf69a9169aa127fd134f58 *src/libpq/Makefile.global.win64
cf791fc03435238d03ca7664b7538e8c *src/libpq/Makefile.global.win32
a881f40366f80b26dc5e22853e77947e *src/libpq/Makefile.global.win64
cd612b52f4c8225182a8dbd899de2b18 *src/libpq/Makefile.port.darwin
fc91b22c9650df71dac423b8c615456f *src/libpq/Makefile.shlib.darwin
2a827d907d7ae4c581a88048adc7fb10 *src/libpq/Makefile.win
d2198b6fb37817b8ecf64b1b356a00c1 *src/libpq/Makefile.win
33e110f7d452968a67b252fa7164f357 *src/libpq/Makefile.win32
92c6d2478320dcb7596b189e1404f462 *src/libpq/README
2e7242f1ece722fe791f2f6f9006e3be *src/libpq/auth.h
Expand Down Expand Up @@ -200,8 +200,8 @@ c630806cb0402e31f89090aff0ecd7c8 *tests/dateTZ.Rout.save
56aca01c53c0d47ead114f0ffe86afc4 *tests/datetimeTests.Rout.save
426a085a5107df0ff90abfcbfdc7aa2f *tests/datetimestampwrite.R
84876402e7c097525de2265ddd9ea8c3 *tests/datetimestampwrite.Rout.save
a969fcea30b3b9c6f15677fed5220808 *tests/dbColumnInfo.R
b1de563cfb212a2835c888427b526a41 *tests/dbColumnInfo.Rout.save
261b1170fc756656faeb6709ec9b23ae *tests/dbColumnInfo.R
230a45ed27dc6b5361823b025b44fe06 *tests/dbColumnInfo.Rout.save
728c6b4d298bde0a78fa0b6bdba9b6e6 *tests/dbExistsIssue.R
de405efbfaea74b557dc0e5b50c8375c *tests/dbExistsIssue.Rout.save
84ed5ec8c2418f4f502ccdda3c09f7f9 *tests/dbExistsq.R
Expand All @@ -215,7 +215,7 @@ de405efbfaea74b557dc0e5b50c8375c *tests/dbExistsIssue.Rout.save
780ac2b734047a7e32a2fc7929b2f50e *tests/dbTransactionTests.R
25e8edc73c52f12499f23b415f248934 *tests/dbTransactionTests.Rout.save
2c6f2e4af6002c96fd9370f6a882fa28 *tests/dbWriteTableFailTest.R
a8a839e6e5b6d16d041e3b574395e9d8 *tests/dbWriteTableFailTest.Rout.save
d9466b771e7aae24656ee2c7ac86128a *tests/dbWriteTableFailTest.Rout.save
817a51900be6d35839f958f8c03fde3d *tests/dbWriteTableSchema.R
96b11b6e8a0b4553e6c38f3a5a0df010 *tests/dbWriteTableSchema.Rout.save
cce64727d6f71c31443f2bd15a91fda3 *tests/dbWriteTableTest.R
Expand All @@ -229,10 +229,12 @@ cd760690292bf52f36df9823ccd3d048 *tests/dbWriteTabletypes.Rout.save
580af6ae7d31aa856eb39f9028ecdc78 *tests/loadDriverAndConnect.R
91f168c4835294a046e90f2ac35390d8 *tests/loadDriverAndConnect.Rout.save
1c45b989cd5bb3125fca11bd30d41a97 *tests/openSendQuery.R
5959e12a901e190ea196e8359c29984c *tests/openSendQuery.Rout.save
cca7a3232974ffec11f9bfde5f2581f5 *tests/openSendQuery.Rout.save
2eea86fb5f793df420647561bcddd07c *tests/selectWhereZero.R
f55eb8813659e464c9bdce95c8d0a282 *tests/selectWhereZero.Rout.save
2bdcf2cc399042c30814e59107dc1170 *tests/selectWithAlias.R
3be49c11b036ebaf33b562b16e022501 *tests/selectWithAlias.Rout.save
e2da0d437b3951cfdcd12ff309032764 *tests/unknowntype.R
29527a4070ec4f7166ffc85a124c2155 *tests/unknowntype.Rout.save
a3f5b3f1eb0c2d200e4b480b6af08de2 *tests/unknowntype.Rout.save
3a63310ff1191115c9f6e1526ba6800b *tests/utf.R
bedb143aecfad1f37e4e0b2e1867198d *tests/utf.Rout.save
32 changes: 18 additions & 14 deletions R/PostgreSQLSupport.R
Expand Up @@ -45,7 +45,7 @@ postgresqlDescribeDriver <- function(obj, verbose = FALSE, ...) {
}
cat(" Open connections:", info$"num_con", "\n")
if(verbose && !is.null(info$connectionIds)){
for(i in seq(along = info$connectionIds)){
for(i in seq_along(info$connectionIds)){
cat(" ", i, " ")
print(info$connectionIds[[i]])
}
Expand All @@ -61,7 +61,7 @@ postgresqlDriverInfo <- function(obj, what="", ...) {
## replace drv/connection id w. actual drv/connection objects
conObjs <- vector("list", length = info$"num_con")
ids <- info$connectionIds
for(i in seq(along = ids))
for(i in seq_along(ids))
conObjs[[i]] <- new("PostgreSQLConnection", Id = c(drvId, ids[i]))
info$connectionIds <- conObjs
info$managerId <- new("PostgreSQLDriver", Id = drvId)
Expand Down Expand Up @@ -131,7 +131,7 @@ postgresqlDescribeConnection <- function(obj, verbose = FALSE, ...) {
cat(" PostgreSQL server thread id: ", info$threadId, "\n")
}
if (length(info$rsId)>0) {
for (i in seq(along = info$rsId)) {
for (i in seq_along(info$rsId)) {
cat(" ", i, " ")
print(info$rsId[[i]])
}
Expand Down Expand Up @@ -161,7 +161,7 @@ postgresqlConnectionInfo <- function(obj, what="", ...) {
id <- as(obj, "integer")
info <- .Call(RS_PostgreSQL_connectionInfo, id)
rsId <- vector("list", length = length(info$rsId))
for(i in seq(along = info$rsId))
for(i in seq_along(info$rsId))
rsId[[i]] <- new("PostgreSQLResult", Id = c(id, info$rsId[i]))
info$rsId <- rsId
if(!missing(what))
Expand Down Expand Up @@ -310,7 +310,7 @@ postgresqlDescribeFields <- function(res, ...) {

flds$type <- .Call(RS_PostgreSQL_typeNames, as.integer(flds$type))
## no factors
structure(flds, row.names = paste(seq(along=flds$type)),
structure(flds, row.names = paste(seq_along(flds$type)),
class = "data.frame")
}
else data.frame(flds)
Expand Down Expand Up @@ -421,8 +421,6 @@ postgresqlFetch <- function(res, n=0, ...) {
n <- as(n, "integer")
rsId <- as(res, "integer")
rel <- .Call(RS_PostgreSQL_fetch, rsId, nrec = n)
if(length(rel)==0 || length(rel[[1]])==0)
return(NULL)
## create running row index as of previous fetch (if any)
cnt <- dbGetRowCount(res)
nrec <- length(rel[[1]])
Expand All @@ -433,14 +431,20 @@ postgresqlFetch <- function(res, n=0, ...) {
else
oldClass(rel) <- "data.frame"

drop_infinity <- function(x){ if(is.na(x)) NA else if(x == 'infinity' || x == '-infinity'){warning(x, ": infinity in date data detected") ; NA} else x}
flds <- dbGetInfo(res)$fieldDescription[[1]]$type
for(i in 1:length(flds)) {
if(flds[[i]] == 1114) { ## 1114 corresponds to Timestamp without TZ (mapped to POSIXct class)
rel[,i] <- as.POSIXct(rel[,i])
} else if(flds[[i]] == 1082) { ## 1082 corresponds to Date (mapped to Date class)
rel[,i] <- as.Date(rel[,i])
} else if(flds[[i]] == 1184) { ## 1184 corresponds to Timestamp with TimeZone
rel[,i] <- as.POSIXct(sub('([+-]..)$', '\\100', sub(':(..)$','\\1' ,rel[,i])), format="%Y-%m-%d %H:%M:%OS%z")
if(length(rel[,1])>0){
for(i in 1:length(flds)) {
if(flds[[i]] == 1114) { ## 1114 corresponds to Timestamp without TZ (mapped to POSIXct class)
rel[,i] <- sapply(rel[,i], drop_infinity)
rel[,i] <- as.POSIXct(rel[,i])
} else if(flds[[i]] == 1082) { ## 1082 corresponds to Date (mapped to Date class)
rel[,i] <- sapply(rel[,i], drop_infinity)
rel[,i] <- as.Date(rel[,i])
} else if(flds[[i]] == 1184) { ## 1184 corresponds to Timestamp with TimeZone
rel[,i] <- sapply(rel[,i], drop_infinity)
rel[,i] <- as.POSIXct(sub('([+-]..)$', '\\100', sub(':(..)$','\\1' ,rel[,i])), format="%Y-%m-%d %H:%M:%OS%z")
}
}
}
rel
Expand Down

0 comments on commit f862fe6

Please sign in to comment.