Description Usage Arguments Details Examples
Manage multiple connections on a stack
1 2 3 4 5 6 7 8 9 | push_conn()
pop_conn()
swap_conn()
rotate_stack(n = 1L)
show_conn_stack()
|
n |
number of shifts |
These functions allow you to store multiple connections on a stack. They are
only used for their side-effects. rpg
stores an active connection
pointer internally. This pointer can be moved onto the stack and manipulated.
Once on the stack, the pointer is no longer active. You must use
swap_conn
or pop_conn
to reactive a pushed connection, or call
connect
to create a new active connection.
push_conn
pushes the current connection onto the connection stack
leaving the active connection null.
pop_conn
pops a connection off the stack and makes it active. Whatever
connection was active when pop_conn
is called will be disconnected and
cleared. Use swap_conn
to preserve the active connection.
swap_conn
swaps the active connection with the connection on the top
of the stack. If the stack is empty, the connection is swapped with a null
connection.
rotate_stack
moves the bottom of the stack to the top.
show_conn_stack
returns a data frame with information about the
connections on the stack.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## Not run:
# make some databases
dbs = paste0("rpgdb", 1:3)
lapply(paste("createdb", dbs), system)
# connect
connect(dbname = dbs[1]); push_conn()
connect(dbname = dbs[2]); push_conn()
connect(dbname = dbs[3]); push_conn()
show_conn_stack()
rotate_stack()
show_conn_stack()
rotate_stack(2)
show_conn_stack()
pop_conn()
show_conn_stack()
get_conn_info("dbname")
swap_conn()
show_conn_stack()
get_conn_info("dbname")
pop_conn()
show_conn_stack()
pop_conn()
show_conn_stack()
disconnect()
connect()
lapply(paste("dropdb", dbs), system)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.