[rpostgresql] r220 committed - mv isIdCurrent to isPostgresqlIdCurrent

10 views
Skip to first unread message

rpost...@googlecode.com

unread,
Dec 3, 2011, 7:51:15 AM12/3/11
to rpostgr...@googlegroups.com
Revision: 220
Author: tomo...@kenroku.kanazawa-u.ac.jp
Date: Sat Dec 3 04:50:46 2011
Log: mv isIdCurrent to isPostgresqlIdCurrent
http://code.google.com/p/rpostgresql/source/detail?r=220

Added:
/trunk/RPostgreSQL/man/isPostgresqlIdCurrent.Rd
Deleted:
/trunk/RPostgreSQL/man/isIdCurrent.Rd
Modified:
/trunk/RPostgreSQL/NAMESPACE
/trunk/RPostgreSQL/R/PostgreSQL.R
/trunk/RPostgreSQL/R/PostgreSQLSupport.R
/trunk/RPostgreSQL/R/dbObjectId.R
/trunk/RPostgreSQL/man/dbObjectId-class.Rd
/trunk/RPostgreSQL/man/postgresqlSupport.Rd

=======================================
--- /dev/null
+++ /trunk/RPostgreSQL/man/isPostgresqlIdCurrent.Rd Sat Dec 3 04:50:46 2011
@@ -0,0 +1,44 @@
+% $Id: isPostgresqlIdCurrent.Rd,v 0.1 2008/07/23 02:38:31 psk Exp $
+\name{isPostgresqlIdCurrent}
+\alias{isPostgresqlIdCurrent}
+\title{
+ Check whether a database handle object is valid or not
+}
+\description{
+Support function that verifies that an object holding a reference
+to a foreign object is still valid for communicating with the RDBMS
+}
+\usage{
+isPostgresqlIdCurrent(obj)
+}
+\arguments{
+\item{obj}{
+any \code{dbObject} (e.g., \code{dbDriver},
+\code{dbConnection}, \code{dbResult}).
+}
+}
+\value{
+a logical scalar.
+}
+\details{
+\code{dbObjects} are R/S-Plus remote references to foreign objects.
+This introduces differences to the object's semantics such as
+persistence (e.g., connections may be closed unexpectedly),
+thus this function provides a minimal verification to ensure
+that the foreign object being referenced can be contacted.
+}
+\seealso{
+\code{\link[DBI]{dbDriver}}
+\code{\link[DBI]{dbConnect}}
+\code{\link[DBI]{dbSendQuery}}
+\code{\link[DBI]{fetch}}
+}
+\examples{\dontrun{
+cursor <- dbSendQuery(con, sql.statement)
+isIdCurrent(cursor)
+}
+}
+\keyword{interface}
+\keyword{database}
+% docclass is function
+% vim: syntax=tex
=======================================
--- /trunk/RPostgreSQL/man/isIdCurrent.Rd Sun Sep 14 15:18:56 2008
+++ /dev/null
@@ -1,44 +0,0 @@
-% $Id: isIdCurrent.Rd,v 0.1 2008/07/23 02:38:31 psk Exp $
-\name{isIdCurrent}
-\alias{isIdCurrent}
-\title{
- Check whether a database handle object is valid or not
-}
-\description{
-Support function that verifies that an object holding a reference
-to a foreign object is still valid for communicating with the RDBMS
-}
-\usage{
-isIdCurrent(obj)
-}
-\arguments{
-\item{obj}{
-any \code{dbObject} (e.g., \code{dbDriver},
-\code{dbConnection}, \code{dbResult}).
-}
-}
-\value{
-a logical scalar.
-}
-\details{
-\code{dbObjects} are R/S-Plus remote references to foreign objects.
-This introduces differences to the object's semantics such as
-persistence (e.g., connections may be closed unexpectedly),
-thus this function provides a minimal verification to ensure
-that the foreign object being referenced can be contacted.
-}
-\seealso{
-\code{\link[DBI]{dbDriver}}
-\code{\link[DBI]{dbConnect}}
-\code{\link[DBI]{dbSendQuery}}
-\code{\link[DBI]{fetch}}
-}
-\examples{\dontrun{
-cursor <- dbSendQuery(con, sql.statement)
-isIdCurrent(cursor)
-}
-}
-\keyword{interface}
-\keyword{database}
-% docclass is function
-% vim: syntax=tex
=======================================
--- /trunk/RPostgreSQL/NAMESPACE Sat Dec 3 04:27:53 2011
+++ /trunk/RPostgreSQL/NAMESPACE Sat Dec 3 04:50:46 2011
@@ -60,7 +60,7 @@
export(
PostgreSQL,
postgresqlBuildTableDefinition,
- isIdCurrent,
+ isPostgresqlIdCurrent,
.PostgreSQLKeywords,
postgresqlInitDriver,
postgresqlCloseDriver,
=======================================
--- /trunk/RPostgreSQL/R/PostgreSQL.R Sat Dec 3 04:33:23 2011
+++ /trunk/RPostgreSQL/R/PostgreSQL.R Sat Dec 3 04:50:46 2011
@@ -120,7 +120,7 @@

setMethod("dbGetException", "PostgreSQLConnection",
def = function(conn, ...){
- if(!isIdCurrent(conn))
+ if(!isPostgresqlIdCurrent(conn))
stop(paste("expired", class(conn)))
.Call("RS_PostgreSQL_getException", as(conn, "integer"),
PACKAGE = .PostgreSQLPkgName)
=======================================
--- /trunk/RPostgreSQL/R/PostgreSQLSupport.R Sat Dec 3 04:33:23 2011
+++ /trunk/RPostgreSQL/R/PostgreSQLSupport.R Sat Dec 3 04:50:46 2011
@@ -25,7 +25,7 @@
}

postgresqlCloseDriver <- function(drv, ...) {
- if(!isIdCurrent(drv))
+ if(!isPostgresqlIdCurrent(drv))
return(TRUE)
drvId <- as(drv, "integer")
.Call("RS_PostgreSQL_closeManager", drvId, PACKAGE = .PostgreSQLPkgName)
@@ -55,7 +55,7 @@
}

postgresqlDriverInfo <- function(obj, what="", ...) {
- if(!isIdCurrent(obj))
+ if(!isPostgresqlIdCurrent(obj))
stop(paste("expired", class(obj)))
drvId <- as(obj, "integer")
info <- .Call("RS_PostgreSQL_managerInfo", drvId, PACKAGE
= .PostgreSQLPkgName)
@@ -76,34 +76,22 @@
## The distinction between "" and NULL is that "" is interpreted by
## the PostgreSQL API as the default database (PostgreSQL config specific)
## while NULL means "no database".
-postgresqlNewConnection <- function(drv, user="", password="",
- host="",dbname = "",
- port = "", tty ="",options="" ) {
- if (!isIdCurrent(drv))
+postgresqlNewConnection <- function(drv, user = "", password = "",
+ host = "", dbname = "",
+ port = "", tty = "", options = "") {
+ if(!isPostgresqlIdCurrent(drv))
stop("expired manager")
- if (is.null(user))
- stop("user argument cannot be NULL")
- if (is.null(password))
- stop("password argument cannot be NULL")
- if (is.null(host))
- stop("host argument cannot be NULL")
- if (is.null(dbname))
- stop("dbname argument cannot be NULL")
- if (is.null(port))
- stop("port argument cannot be NULL")
- if (is.null(tty))
- stop("tty argument cannot be NULL")
con.params <- as.character(c(user, password, host,
dbname, port,
- tty,options))
+ tty, options))

drvId <- as(drv, "integer")
- conId <- .Call("RS_PostgreSQL_newConnection", drvId,
con.params,PACKAGE = .PostgreSQLPkgName)
+ conId <- .Call("RS_PostgreSQL_newConnection", drvId, con.params,
PACKAGE = .PostgreSQLPkgName)
new("PostgreSQLConnection", Id = conId)
}

postgresqlCloneConnection <- function(con, ...) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
newId <- .Call("RS_PostgreSQL_cloneConnection", conId, PACKAGE
= .PostgreSQLPkgName)
@@ -138,7 +126,7 @@
}

postgresqlCloseConnection <- function(con, ...) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
return(TRUE)
rs <- dbListResults(con)
if(length(rs)>0){
@@ -152,7 +140,7 @@
}

postgresqlConnectionInfo <- function(obj, what="", ...) {
- if(!isIdCurrent(obj))
+ if(!isPostgresqlIdCurrent(obj))
stop(paste("expired", class(obj), deparse(substitute(obj))))
id <- as(obj, "integer")
info <- .Call("RS_PostgreSQL_connectionInfo", id, PACKAGE
= .PostgreSQLPkgName)
@@ -189,7 +177,7 @@
## output, otherwise it produces a resultSet that can
## be used for fetching rows.
postgresqlExecStatement <- function(con, statement) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
statement <- as(statement, "character")
@@ -205,21 +193,21 @@
}

postgresqlpqExec <- function(con, statement) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
statement <- as(statement, "character")
.Call("RS_PostgreSQL_pqexec", conId, statement, PACKAGE
= .PostgreSQLPkgName)
}
postgresqlCopyIn <- function(con, filename) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
filename <- as(filename, "character")
.Call("RS_PostgreSQL_CopyIn", conId, filename, PACKAGE
= .PostgreSQLPkgName)
}
postgresqlCopyInDataframe <- function(con, dataframe) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
nrow <- nrow(dataframe)
@@ -227,7 +215,7 @@
.Call("RS_PostgreSQL_CopyInDataframe", conId, dataframe, nrow, p ,
PACKAGE = .PostgreSQLPkgName)
}
postgresqlgetResult <- function(con) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
conId <- as(con, "integer")
rsId <- .Call("RS_PostgreSQL_getResult", conId, PACKAGE
= .PostgreSQLPkgName)
@@ -238,7 +226,7 @@
## helper function: it exec's *and* retrieves a statement. It should
## be named somehting else.
postgresqlQuickSQL <- function(con, statement) {
- if(!isIdCurrent(con))
+ if(!isPostgresqlIdCurrent(con))
stop(paste("expired", class(con)))
nr <- length(dbListResults(con))
if (nr > 0) { ## are there resultSets pending on con?
@@ -441,7 +429,7 @@
## and INSERTS, ... Later on we created a base class dbResult
## for non-Select SQL and a derived class resultSet for SELECTS.
postgresqlResultInfo <- function(obj, what = "", ...) {
- if(!isIdCurrent(obj))
+ if(!isPostgresqlIdCurrent(obj))
stop(paste("expired", class(obj), deparse(substitute(obj))))
id <- as(obj, "integer")
info <- .Call("RS_PostgreSQL_resultSetInfo", id, PACKAGE
= .PostgreSQLPkgName)
@@ -452,7 +440,7 @@
}

postgresqlDescribeResult <- function(obj, verbose = FALSE, ...) {
- if(!isIdCurrent(obj)){
+ if(!isPostgresqlIdCurrent(obj)){
print(obj)
invisible(return(NULL))
}
@@ -470,7 +458,7 @@
}

postgresqlCloseResult <- function(res, ...) {
- if(!isIdCurrent(res))
+ if(!isPostgresqlIdCurrent(res))
return(TRUE)
rsId <- as(res, "integer")
.Call("RS_PostgreSQL_closeResultSet", rsId, PACKAGE
= .PostgreSQLPkgName)
=======================================
--- /trunk/RPostgreSQL/R/dbObjectId.R Sat Oct 1 06:16:39 2011
+++ /trunk/RPostgreSQL/R/dbObjectId.R Sat Dec 3 04:50:46 2011
@@ -42,7 +42,7 @@

setMethod("print", "dbObjectId",
def = function(x, ...){
- expired <- if(isIdCurrent(x)) "" else "Expired "
+ expired <- if(isPostgresqlIdCurrent(x)) "" else "Expired "
str <- paste("<", expired, class(x), ":", format(x), ">",
sep="")
cat(str, "\n")
invisible(NULL)
@@ -50,7 +50,7 @@
)

## verify that obj refers to a currently open/loaded database
-isIdCurrent <- function(obj) {
+isPostgresqlIdCurrent <- function(obj) {
obj <- as(obj, "integer")
.Call("RS_DBI_validHandle", obj, PACKAGE = .PostgreSQLPkgName)
}
=======================================
--- /trunk/RPostgreSQL/man/dbObjectId-class.Rd Sun Sep 14 15:18:56 2008
+++ /trunk/RPostgreSQL/man/dbObjectId-class.Rd Sat Dec 3 04:50:46 2011
@@ -36,10 +36,10 @@
con <- dbConnect(pg, "user", "password")
is(pg, "dbObjectId") ## True
is(con, "dbObjectId") ## True
- isIdCurrent(con) ## True
+ isPostgresqlIdCurrent(con) ## True
q("yes")
\$ R
- isIdCurrent(con) ## False
+ isPostgresqlIdCurrent(con) ## False
}
}
\keyword{classes}
=======================================
--- /trunk/RPostgreSQL/man/postgresqlSupport.Rd Fri Aug 26 01:37:23 2011
+++ /trunk/RPostgreSQL/man/postgresqlSupport.Rd Sat Dec 3 04:50:46 2011
@@ -65,7 +65,7 @@

## data mappings, convenience functions, and extensions
postgresqlDataType(obj, ...)
- postgresqlReadTable(con, name, row.names = "row_names", check.names =
TRUE, ...)
+ postgresqlReadTable(con, name, row.names = "row.names", check.names =
TRUE, ...)
postgresqlWriteTable(con, name, value, field.types, row.names = TRUE,
overwrite=FALSE, append=FALSE, ..., allow.keywords = FALSE)
postgresqlpqExec(con, statement)

Reply all
Reply to author
Forward
0 new messages