Skip to content

Commit

Permalink
version 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomoaki Nishiyama authored and gaborcsardi committed Mar 27, 2013
1 parent 4a1566b commit ce48a7d
Show file tree
Hide file tree
Showing 30 changed files with 686 additions and 200 deletions.
31 changes: 30 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
2013-03-27 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>

Document synchronization and testoutputs.

* man/postgresqlSupport.Rd

2013-03-27 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>

Change notation of LICENSE in DESCRIPTION upon request from CRAN

* LICENSE
* inst/NEWS
* inst/ANNOUNCEMENTS
* inst/TODO

2013-03-27 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>

Use system libpq library when available on OS X (darwin)

* src/configure.in
* src/configure

2012-12-06 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>

Test implementation of SQL with parameters.

* R/PostgreSQLSupport.R
* src/RS-pgsql-pqexecparams.c
* tests/dbGetQueryParams.R

2012-10-04 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>

Bug fix for GC related errro as reported as issue 42.
Expand All @@ -19,7 +49,6 @@
* configure
* configure.in


2012-04-06 Tomoaki NISHIYAMA <tomoakin@staff.kanazawa-u.ac.jp>

For issue 39: use a single equal sign (=) in test string comparison
Expand Down
13 changes: 7 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: RPostgreSQL
Version: 0.3-3
Date: $Date: 2012-10-04 10:54:50 +0900 (Thu, 04 Oct 2012) $
Version: 0.4
Date: $Date: 2013-03-27 15:32:53 +0900 (Wed, 27 Mar 2013) $
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@kenroku.kanazawa-u.ac.jp>
Maintainer: Tomoaki Nishiyama <tomoakin@staff.kanazawa-u.ac.jp>
Description: Database interface and PostgreSQL driver for R This
package provides a Database Interface (DBI) compliant driver
for R to access PostgreSQL database systems.
Expand All @@ -22,12 +22,13 @@ Description: Database interface and PostgreSQL driver for R This
Google Code at https://code.google.com/p/rpostgresql/ .
LazyLoad: true
Depends: R (>= 2.9.0), methods, DBI (>= 0.1-4)
License: GPL-2 | GPL-2 + file LICENSE
License: GPL-2 | 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://code.google.com/p/rpostgresql/,
http://www.stat.bell-labs.com/RS-DBI, http://www.postgresql.org
Packaged: 2012-10-05 00:57:35 UTC; tomoaki
Packaged: 2013-03-27 07:24:02 UTC; tomoaki
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2012-10-05 05:35:18
Date/Publication: 2013-03-27 09:34:11
53 changes: 29 additions & 24 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
bf65d5f75400740639055c3164545b5c *ChangeLog
8592b1db641e7cb99a4af2495a54a35a *DESCRIPTION
3f7fa2f8347ec616473e2918c825c4a8 *ChangeLog
bf3109a70c05f48325af4218823659cd *DESCRIPTION
c8af6d9e6bc5bf68e12a361ef92d8ed2 *LICENSE
07abd6526506cad69dacbcd85056df39 *NAMESPACE
2d9f70685a274782a6294593052b35c9 *R/PostgreSQL.R
5967cad92a41a0bcbed17f0668e98985 *R/PostgreSQLSupport.R
b56915fa57c40d3e4f0af3e59dc7b493 *R/PostgreSQLSupport.R
f1e33290ef23cbc9449f04fcbce86312 *R/S4R.R
ae8e0a406bd6a67e42a78955c7f52bb7 *R/dbObjectId.R
c2656a583e3cdce783d45843fcff2dbf *R/zzz.R
4b5e59c53d38086590d8d8553853ab04 *cleanup
cd97f90bb8f96381bc90618f20f92e37 *config.guess
1909cacd8bdd9e8b01df53649a497e74 *config.sub
45da35c3295cf31ef488a03511cdc8bb *configure
2b280e5aa4102a39982c1175edff3dcc *configure.in
8afc018fc84088e30a20cd7c3cd54207 *configure
59610639849c0de238bd133cbffd7ade *configure.in
d41d8cd98f00b204e9800998ecf8427e *configure.win
a93eb17deebc9c9f4831891d57225b88 *inst/ANNOUNCEMENT
4115f66c52c6224c5026bd8916832af5 *inst/NEWS
530c860675440e6e1b7266ad2515b6c1 *inst/ANNOUNCEMENT
d01dfae1ce37b71f11a83b4c73199d9e *inst/NEWS
86063092fe732dcbc47a4830ca72703c *inst/README
b73cbf6aae0e4d6ece79307f8a86713f *inst/THANKS
fdd736eeea8856edd37fe2eee71cf868 *inst/TODO
0bf2e533fb61584e1944dcdf68614083 *inst/TODO
4d641c77d10b666e344bba4f2fafaa7c *inst/devTests/PostgreSQLDataTypeTest.r
9d52c4bf4d849a301af44570c89fce02 *inst/devTests/copyTest.sh
61641de7231675096668d2800bfd6c57 *inst/devTests/datetime.r
b42cfbf562a28612beb8acfe0f716c61 *inst/devTests/demo.r
0cda913b0e5e9141de5ee02ce25bff4d *inst/devTests/timeTypeComparison.r
5c86f87f1eb660bf799f2a6e49e75175 *inst/devTests/transactionManagement.r
cb8f0f0ce13da24f66f2ac2422cdbc01 *inst/devTests/typeTest.r
a30dcb6178732e71decef570bd24b26d *inst/doc/DBI.pdf
2f879f8f4c271f8c1379203ef6cff430 *inst/doc/DBI.pdf
d41d8cd98f00b204e9800998ecf8427e *install-sh
3189110650497edadc574cf9deda2e7a *man/PostgreSQL.Rd
34be8b01589cc63c1e2c14fc923a0296 *man/PostgreSQLConnection-class.Rd
Expand All @@ -37,7 +37,7 @@ d541cbaa9168c4d82b0d7e1e0288de9a *man/dbApply-methods.Rd
03b366bccc90c81553c337f03b174e18 *man/dbApply.Rd
e8793fead8804448561a8ef74d1ec9f5 *man/dbCallProc-methods.Rd
7a0abc8f1238eb5cca55526429ddbf1d *man/dbCommit-methods.Rd
0fe9f7d5c7aa82dfdc4594d5b029f354 *man/dbConnect-methods.Rd
d586146c693604b9b6fbd5cde0974259 *man/dbConnect-methods.Rd
9d7463dd5c62ad6702dc32ee19e3d6f0 *man/dbDataType-methods.Rd
16246c517381c4a0e74d36ffbc2aceae *man/dbDriver-methods.Rd
5e4129ab26a9e7b0f2fe1aa4f9c9a4f4 *man/dbGetInfo-methods.Rd
Expand All @@ -51,18 +51,19 @@ adbcc9466e503793f67868bad5dd9b41 *man/dbSetDataMappings-methods.Rd
cf55e6b7dbfc0e553833452c1e56d460 *man/make.db.names-methods.Rd
09e873e5bfb1341f94a0384fe54bd2e8 *man/postgresqlBuildTableDefinition.Rd
efefe77c91468729e7f3f44d2baa9e96 *man/postgresqlDBApply.Rd
53c37275687ec67b72eecaee8864148f *man/postgresqlSupport.Rd
a8c25b61df8cac8b0f4577119bfb3179 *man/postgresqlSupport.Rd
1fa83980e75922372ce35309a6d37ab7 *man/summary-methods.Rd
d6e06acf69eb5a72bba126285917aeab *src/Makevars.in
28b4fca3fd3ae85de4b1d1bb480c0837 *src/Makevars.win
c6baf242552520ab2ce3fe5977f6d2a1 *src/RS-DBI.c
2813421b9a2f7eba64282f49b00bed8e *src/RS-DBI.c
259d16ef0b9e0f8f45a7c8a845744285 *src/RS-DBI.h
36dbad7938bb2d8b33267b7363c8ef09 *src/RS-PQescape.c
f2ea6c2b8e43a9d143b5546f7c3fd885 *src/RS-PostgreSQL.c
153c3a456e21502b44c3ef36ff6e5d93 *src/RS-PostgreSQL.c
a097d25581003eb54dba6f63338e0ad4 *src/RS-PostgreSQL.h
9df3f59ddf2ae1c959651a25ff8377b3 *src/RS-pgsql-copy.c
ad6938746ab4aed7cd921cf7aa185620 *src/RS-pgsql-getResult.c
3029b173216fd1941bc6c9d4fbbd3249 *src/RS-pgsql-pqexec.c
b94b0a6e17f9c149155f7797bd093fd7 *src/RS-pgsql-pqexecparams.c
25f7757eb3ce49bd5c0faf5d38995a84 *src/S4R.h
ef344a9f1740fa86ca1465e306fc30bf *src/libpq/COPYRIGHT
70210c09c015458c661a500f794d90cd *src/libpq/Makefile.darwin
Expand Down Expand Up @@ -162,41 +163,45 @@ bc4feb5f45590b44f80befe2930a8a21 *tests/connectWithNull.Rout.save
d9adf68fe977b8a2f019d509bed22418 *tests/createTableMixedCaseTest.Rout.save
e312e82ea55ce3ae4e334d4a033b7186 *tests/dataTypeTests.R
12ea74767ddf32212282b3638e0331e2 *tests/dataTypeTests.Rout.save
1c71d86f2e1548987a6513146f66dcc5 *tests/datetimeTests.R
150d4f2e2d081e8370f003c852525f8a *tests/datetimeTests.Rout.save
a21f53ad7089fb53ab0e99e7a72152ef *tests/dateTZ.R
e606772d639a4584fdf627ff9e4bc5a4 *tests/dateTZ.Rout.save
5dd14260ac121755f95804a805845639 *tests/datetimeTests.R
1c26ec805ee49b912b72c1a64fecca4b *tests/datetimeTests.Rout.save
426a085a5107df0ff90abfcbfdc7aa2f *tests/datetimestampwrite.R
ecc4a3ef519746e1a6356714bae38861 *tests/datetimestampwrite.Rout.save
b0e89adfef654419f9535a4a27a0fb05 *tests/datetimestampwrite.Rout.save
068d06765ebc0b4193679458681f5492 *tests/dbColumnInfo.R
cfd0aed69408e4a8dd0e16849fad502c *tests/dbColumnInfo.Rout.save
728c6b4d298bde0a78fa0b6bdba9b6e6 *tests/dbExistsIssue.R
9ec0ad71ef0d45c84f3b577e4e534cfb *tests/dbExistsIssue.Rout.save
84ed5ec8c2418f4f502ccdda3c09f7f9 *tests/dbExistsq.R
3683a308c16552827c0ecfe0f220bc19 *tests/dbExistsq.Rout.save
7cdfa345c748deaa09d12a425dc27274 *tests/dbExistsqc.R
7d2110d9b9969536fac9ad63475c69fb *tests/dbExistsqc.Rout.save
dfda2558194715178599544633b91ac3 *tests/dbExistsqc.Rout.save
2452d72357ecbb7644f853277d73ecbc *tests/dbGetQueryParams.R
8c83ee42b8de354904ad510e0f23c976 *tests/dbGetQueryParams.Rout.save
7ede6c5869d6aceaa8e7fdf71d272f0c *tests/dbListFields.R
b58e998b4528779321eb55567db16f8d *tests/dbListFields.Rout.save
85b4a7a761329f7e5860426086a2b7ab *tests/dbListFields.Rout.save
780ac2b734047a7e32a2fc7929b2f50e *tests/dbTransactionTests.R
39ba02e7761d7b5e2aa7a3dbdb8a2b1b *tests/dbTransactionTests.Rout.save
58dfaf1772f7b287f6d2f68b917245d6 *tests/dbTransactionTests.Rout.save
2c6f2e4af6002c96fd9370f6a882fa28 *tests/dbWriteTableFailTest.R
8797ead966f10a791790e437567b84e1 *tests/dbWriteTableFailTest.Rout.save
fc95e0249d08c8b06c7fd2b3c68177ec *tests/dbWriteTableFailTest.Rout.save
817a51900be6d35839f958f8c03fde3d *tests/dbWriteTableSchema.R
44021be4e054858e72a89ea0bcfbc1fb *tests/dbWriteTableSchema.Rout.save
334de98ade8e6371f9d3b527505ee172 *tests/dbWriteTableSchema.Rout.save
cce64727d6f71c31443f2bd15a91fda3 *tests/dbWriteTableTest.R
7fc7ebfe4fa48b09ceb13590e81b335e *tests/dbWriteTableTest.Rout.save
4402efb6f7f026dc991e377fe6f16b12 *tests/dbWriteTabletypes.R
0c70b831003850e87d8dc29df1de8cf0 *tests/dbWriteTabletypes.Rout.save
73504ebbb74fba62c333e7e2f5dd13c9 *tests/dbWriteTabletypes.Rout.save
2a3b7cc53200dfa695523381227dfeaf *tests/dbtemptable.R
c78e8ab0cf63864cf885fe1f6a737239 *tests/dbtemptable.Rout.save
54a3acc43b0214be8b3ecae3197eeb9d *tests/escape.R
fbcdd68af9bf187137ed3b3382aff6e9 *tests/escape.Rout.save
580af6ae7d31aa856eb39f9028ecdc78 *tests/loadDriverAndConnect.R
45f20321adb6219f15b462e5e161ca97 *tests/loadDriverAndConnect.Rout.save
1c45b989cd5bb3125fca11bd30d41a97 *tests/openSendQuery.R
d2133779b3d9e8aedf275371934a706c *tests/openSendQuery.Rout.save
8522ca7bcfecc0574099c74488eb8f82 *tests/openSendQuery.Rout.save
2eea86fb5f793df420647561bcddd07c *tests/selectWhereZero.R
417ab0d9cc3cbc6fbe3217f4eb2ab757 *tests/selectWhereZero.Rout.save
2bdcf2cc399042c30814e59107dc1170 *tests/selectWithAlias.R
4de3eac64338973043b7293c196e8e7c *tests/selectWithAlias.Rout.save
e2da0d437b3951cfdcd12ff309032764 *tests/unknowntype.R
426e87998d5a434a8f308a85e04fbf6c *tests/unknowntype.Rout.save
f91af8ad0eeecc03a8bf41428ac790c5 *tests/unknowntype.Rout.save
39 changes: 24 additions & 15 deletions R/PostgreSQLSupport.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

## PostgreSQLSupport.R
## $Id: PostgreSQLSupport.R 230 2012-03-29 07:34:49Z tomoakin@kenroku.kanazawa-u.ac.jp $
## $Id: PostgreSQLSupport.R 243 2012-12-06 14:26:41Z tomoakin@kenroku.kanazawa-u.ac.jp $

## This package was developed as a part of Summer of Code program organized by Google.
## Thanks to David A. James & Saikat DebRoy, the authors of RMySQL package.
Expand Down Expand Up @@ -78,7 +78,7 @@ postgresqlDriverInfo <- function(obj, what="", ...) {
## while NULL means "no database".
postgresqlNewConnection <- function(drv, user = "", password = "",
host = "", dbname = "",
port = "", tty = "", options = "") {
port = "", tty = "", options = "", forceISOdate=TRUE) {
if(!isPostgresqlIdCurrent(drv))
stop("expired manager")
if(is.null(user))
Expand All @@ -98,7 +98,11 @@ postgresqlNewConnection <- function(drv, user = "", password = "",

drvId <- as(drv, "integer")
conId <- .Call("RS_PostgreSQL_newConnection", drvId, con.params, PACKAGE = .PostgreSQLPkgName)
new("PostgreSQLConnection", Id = conId)
con <- new("PostgreSQLConnection", Id = conId)
if(forceISOdate){
dbGetQuery(con, "set datestyle to ISO")
}
con
}

postgresqlCloneConnection <- function(con, ...) {
Expand Down Expand Up @@ -187,12 +191,16 @@ postgresqlTransactionStatement <- function(con, statement) {
## dbResult object if the SQL operation does not produce
## output, otherwise it produces a resultSet that can
## be used for fetching rows.
postgresqlExecStatement <- function(con, statement) {
postgresqlExecStatement <- function(con, statement, params, ...) {
if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
statement <- as(statement, "character")
rsId <- .Call("RS_PostgreSQL_exec", conId, statement, PACKAGE = .PostgreSQLPkgName)
if(missing(params)){
rsId <- .Call("RS_PostgreSQL_exec", conId, statement, PACKAGE = .PostgreSQLPkgName)
}else{
rsId <- .External("RS_PostgreSQL_pqexecparams", conId, statement, as(params, "character"), ..., PACKAGE = .PostgreSQLPkgName)
}
new("PostgreSQLResult", Id = rsId)
}

Expand All @@ -210,6 +218,14 @@ postgresqlpqExec <- function(con, statement) {
statement <- as(statement, "character")
.Call("RS_PostgreSQL_pqexec", conId, statement, PACKAGE = .PostgreSQLPkgName)
}
postgresqlpqExecParams <- function(con, statement, ...) {
if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
statement <- as(statement, "character")
.External("RS_PostgreSQL_pqexecparams", conId, statement, ..., PACKAGE = .PostgreSQLPkgName)
}

postgresqlCopyIn <- function(con, filename) {
if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
Expand All @@ -236,14 +252,14 @@ postgresqlgetResult <- function(con) {

## helper function: it exec's *and* retrieves a statement. It should
## be named somehting else.
postgresqlQuickSQL <- function(con, statement) {
postgresqlQuickSQL <- function(con, statement, ...) {
if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
rsList <- dbListResults(con)
if (length(rsList)>0){ # clear results
dbClearResult(rsList[[1]])
}
rs <- try(dbSendQuery(con, statement))
rs <- try(dbSendQuery(con, statement, ...))
if (inherits(rs, ErrorClass)){
warning("Could not create execute", statement)
return(NULL)
Expand Down Expand Up @@ -411,21 +427,14 @@ postgresqlFetch <- function(res, n=0, ...) {

flds <- dbGetInfo(res)$fieldDescription[[1]]$type
for(i in 1:length(flds)) {

## Note: All the Date-Time datatypes in pg except date and TimeStamp were mapped to character

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
## TODO: Details about time zone has been dropped.
## Will try do improve it in the future
#rel[,i] <- as.POSIXct(rel[,i],"%Y-%m-%d %H:%M:%S") # second arg. is tz, so this was wrong
rel[,i] <- as.POSIXct(rel[,i])
rel[,i] <- as.POSIXct(sub('([+-]..)$', '\\100', sub(':(..)$','\\1' ,rel[,i])), format="%Y-%m-%d %H:%M:%OS%z")
}
}

rel
}

Expand Down
46 changes: 26 additions & 20 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,8 @@ case "${host_os}" in
;;
esac
# Check for non-standard programs: pg_configg(1) to configure PostgreSQL builds
# Check for non-standard programs: pg_config(1) to configure PostgreSQL builds
# Extract the first word of "pg_config", so it can be a program name with args.
set dummy pg_config; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
Expand Down Expand Up @@ -2892,6 +2893,8 @@ fi
# By default, we will not use the accompanied libpq
ENABLE_LIBPQ=
# If pg_config was found, let's use it
if test "${PG_CONFIG}" != ""; then
Expand Down Expand Up @@ -2973,6 +2976,28 @@ $as_echo "$as_me: Checking lib ${dir}." >&6;}
fi
done
fi
if ! test $PG_LIBDIR
then
if test "$R_OS_TYPE" = "darwin" ; then
# in case we cannot find any libpq library we will use the accompanied libpq
# This content would be written into src/Makevars at the end of this script
ENABLE_LIBPQ='
PKG_CPPFLAGS=-Ilibpq
PKG_LIBS=libpq/libpq.a
.PHONY: all
all: $(SHLIB)
$(SHLIB): libpq/libpq.5.dylib
libpq/libpq.5.dylib:
(cd libpq; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" -f Makefile.darwin)
clean:
(cd libpq; $(MAKE) -f Makefile.darwin clean)
'
fi
fi
fi
# Expand into arguments
Expand Down Expand Up @@ -3007,25 +3032,6 @@ as_val=`eval 'as_val=${'$as_ac_File'}
ENABLE_LIBPQ=
if test "$R_OS_TYPE" = "darwin" ; then
ENABLE_LIBPQ='
PKG_CPPFLAGS=-Ilibpq
PKG_LIBS=libpq/libpq.a
.PHONY: all
all: $(SHLIB)
$(SHLIB): libpq/libpq.5.dylib
libpq/libpq.5.dylib:
(cd libpq; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" -f Makefile.darwin)
clean:
(cd libpq; $(MAKE) -f Makefile.darwin clean)
'
fi
ac_config_files="$ac_config_files src/Makevars"
Expand Down

0 comments on commit ce48a7d

Please sign in to comment.