| List database tables {RPgSQL} | R Documentation |
db.ls lists the database table names in the current database.
db.rm drops database tables. Use carefully!
db.table.exists check if a table name exists in the current
database.
db.ls(pattern, all=F) db.rm(..., pattern, ask=T) db.table.exists(name)
pattern |
A matching pattern or table name |
all |
A boolean indicating whether to list system tables in addition to user tables |
... |
One or more character strings that specify the tables to drop from the database |
ask |
A boolean indicating whether to ask for user approval before dropping each table |
name |
A character string containing a table name |
db.ls |
A list of table names |
db.table.exists |
A boolean |
The pattern can be any valid PostgreSQL regular expression, so
db.rm(pattern='.*', ask=F) will remove all of your database
tables. You have been warned.
Timothy H. Keitt
if (db.connection.open()) {
db.ls(all=T)
data(OrchardSprays)
rpgsql.test.data <- OrchardSprays
rm(OrchardSprays)
db.write.table(rpgsql.test.data, no.clobber=F)
if (db.table.exists('rpgsql_test_data')) {
cat(db.ls(pattern='rpgsql'), "\n")
db.rm('rpgsql_test_data', ask=F)
cat(db.ls(pattern='test_data'), "\n")
}
rm(rpgsql.test.data)
}