Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
3 changes: 3 additions & 0 deletions RPostgreSQL/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.log
*.status
*.dSYM
7 changes: 7 additions & 0 deletions RPostgreSQL/R/PostgreSQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ setMethod("dbConnect", "character",
valueClass = "PostgreSQLConnection"
)

setMethod("dbIsValid", "PostgreSQLConnection",
def = function(dbObj, ... ) isPostgresqlIdCurrent(dbObj, ... ),
valueClass = "logical"
)

## clone a connection
setMethod("dbConnect", "PostgreSQLConnection",
def = function(drv, ...) postgresqlCloneConnection(drv, ...),
Expand Down Expand Up @@ -234,6 +239,7 @@ setMethod("dbListFields",
flds <- dbGetQuery(conn,
paste("select a.attname from pg_attribute a, pg_class c, pg_tables t, pg_namespace nsp",
" where a.attrelid = c.oid and c.relname = tablename and c.relnamespace = nsp.oid and a.attnum > 0 and ",
"not a.attisdropped and ",
"nspname = current_schema() and schemaname = nspname and ",
"tablename = '", postgresqlEscapeStrings(conn, name), "'", sep=""))[,1]
}
Expand All @@ -242,6 +248,7 @@ setMethod("dbListFields",
flds <- dbGetQuery(conn,
paste("select a.attname from pg_attribute a, pg_class c, pg_tables t, pg_namespace nsp",
" where a.attrelid = c.oid and c.relname = t.tablename and c.relnamespace = nsp.oid and a.attnum > 0 and ",
"not a.attisdropped and ",
"nspname = schemaname ",
"and schemaname = '", postgresqlEscapeStrings(conn, name[1]), "' ",
"and tablename = '", postgresqlEscapeStrings(conn, name[2]), "'", sep=""))[,1]
Expand Down
1 change: 1 addition & 0 deletions RPostgreSQL/R/dbObjectId.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ setMethod("print", "dbObjectId",

## verify that obj refers to a currently open/loaded database
isPostgresqlIdCurrent <- function(obj) {
if(is.null(obj)) return(FALSE)
obj <- as(obj, "integer")
.Call(RS_DBI_validHandle, obj)
}
Expand Down
3 changes: 3 additions & 0 deletions RPostgreSQL/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.so
*.o
Makevars