Description Usage Arguments Details Value Author(s) Examples
Conection reporting and defaults
1 2 3 4 5 6 7 8 9 10 11 12 13 | ping(opts = "")
get_conn_error()
get_conn_defaults(all = FALSE)
get_conn_info(what = NULL, hide_password = TRUE)
set_conn_defaults(...)
set_default_password(password = NULL)
reset_conn_defaults()
|
opts |
a libpq connection string |
all |
if false return only defaults with settings |
what |
the fields to return or all if NULL |
hide_password |
if true, do not reveal password used |
... |
a named list of arguments giving new defaults |
password |
the password |
ping
will ignore any keywords not directly
related to the database host (e.g., username, dbname) as it
does not connect; it only detect the server port is responding.
get_conn_defaults
returns a data frame containing
all of the possible connection string keywords, the names of environment
variables used to override the defaults, the compiled in default value
and the current value of the keyword.
get_conn_info
returns a list containing
information about the current connection. For
readability, it will print as though it is a matrix. If
you want to see it as a list, try unclass(get_conn_info())
.
If length(what) == 1
then get_conn_info
returns
a scalar
set_conn_defaults
sets the connection defaults by calling
Sys.setenv
and setting the environment variable associated
with the connection keywords returned by get_conn_defaults(all = TRUE)
.
These settings will only last as long as the current shell session and will
reset after a new login.
set_default_password
will query for a password (if not supplied)
and set the PGPASSWORD
environment variable accordingly. This can be used
with psql
and copy_to
.
reset_conn_defaults
unsets all environment variables returned
by get_conn_defaults(all = TRUE)
.
ping
returns one of the following:
PQPING_OK | Server reachable |
PQPING_REJECT | Server reachable but not accepting connections |
PQPING_NO_RESPONSE | Server unreachable |
PQPING_NO_ATTEMPT | Connection string is nonsense |
get_conn_error: an error string
get_conn_defaults
: a data frame with defaults listed
get_conn_info: a list of values
Timothy H. Keitt
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
ping("connect_timeout = 3, host = www.keittlab.org")
connect()
get_conn_defaults()
set_conn_defaults(dbname = "test")
get_conn_defaults()
reset_conn_defaults()
get_conn_defaults()
get_conn_defaults(all = TRUE)
get_conn_info()
get_conn_error()
disconnect()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.