The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Installation of current released version from CRAN
install.packages("rocker")
Installation of current development version from GitHub
install.packages("devtools")
::install_github("nikolaus77/rocker") devtools
Create new rocker database handling object
Option 1
<- rocker::newDB() # New database handling object
db #> dctr | New object
Option 2
<- rocker::rocker$new() # New database handling object
db #> dctr | New object
Terminal output
Controlling terminal output
<- rocker::newDB(verbose = TRUE) # New database handling object
db #> dctr | New object
$setupPostgreSQL()
db#> Dctr | Driver load RPostgres
$unloadDriver()
db#> dctr | Driver unload RPostgres
$verbose <- FALSE # Terminal output off
db$setupPostgreSQL()
db$unloadDriver() db
$verbose <- TRUE # Terminal output on (default)
db$setupPostgreSQL()
db#> Dctr | Driver load RPostgres
$unloadDriver()
db#> dctr | Driver unload RPostgres
Structure of terminal output
Dctr | Driver load RSQLite
D = Driver (D = loaded, d = not set)
c = Connection (C = opened, c = closed)
t = Transation (T = active, t = no tranastion)
r = Result (R = available, r = no result)
Driver load RSQLite = Message text
Optional object ID
Optionally, rocker object can be labeled with an ID. This can be helpful in case terminal output of multiple rocker objects need to be distinguished.
<- rocker::newDB(id = "myDB 1") # New database handling object with ID
db1 #> myDB 1 | dctr | New object id myDB 1
<- rocker::newDB(id = "myDB 2") # New database handling object with ID
db2 #> myDB 2 | dctr | New object id myDB 2
$setupPostgreSQL()
db1#> myDB 1 | Dctr | Driver load RPostgres
$setupMariaDB()
db2#> myDB 2 | Dctr | Driver load RMariaDB
$unloadDriver()
db1#> myDB 1 | dctr | Driver unload RPostgres
$unloadDriver()
db2#> myDB 2 | dctr | Driver unload RMariaDB
$id <- NULL # Remove ID
db1$setupSQLite()
db1#> Dctr | Driver load RSQLite
$unloadDriver()
db1#> dctr | Driver unload RSQLite
$id <- "newID 1" # Add new ID
db1$setupSQLite()
db1#> newID 1 | Dctr | Driver load RSQLite
$unloadDriver()
db1#> newID 1 | dctr | Driver unload RSQLite
Object properties
Object properties are stored in the info field and can be displayed by print function.
<- rocker::newDB() # New database handling object
db #> dctr | New object
$setupPostgreSQL()
db#> Dctr | Driver load RPostgres
$info
db#> $package
#> [1] "RPostgres"
#>
#> $host
#> [1] "127.0.0.1"
#>
#> $port
#> [1] "5432"
#>
#> $dbname
#> [1] "mydb"
db#> object
#> id null
#> verbose true
#> validateQuery null
#> database
#> package RPostgres
#> host 127.0.0.1
#> port 5432
#> dbname mydb
#> status
#> driver true
#> connection false
#> transaction false
#> result false
$print()
db#> object
#> id null
#> verbose true
#> validateQuery null
#> database
#> package RPostgres
#> host 127.0.0.1
#> port 5432
#> dbname mydb
#> status
#> driver true
#> connection false
#> transaction false
#> result false
print(db)
#> object
#> id null
#> verbose true
#> validateQuery null
#> database
#> package RPostgres
#> host 127.0.0.1
#> port 5432
#> dbname mydb
#> status
#> driver true
#> connection false
#> transaction false
#> result false
$unloadDriver()
db#> dctr | Driver unload RPostgres
Connection validation – Is the earlier opened database connection still open?
<- rocker::newDB() # New database handling object
db #> dctr | New object
$setupSQLite()
db#> Dctr | Driver load RSQLite
$print()
db#> object
#> id null
#> verbose true
#> validateQuery null
#> database
#> package RSQLite
#> dbname :memory:
#> status
#> driver true
#> connection false
#> transaction false
#> result false
During connection setup, a validateQuery is looked up automatically.
$connect()
db#> DCtr | Database connected
$print()
db#> object
#> id null
#> verbose true
#> validateQuery SELECT 1
#> database
#> package RSQLite
#> dbname :memory:
#> status
#> driver true
#> connection true
#> transaction false
#> result false
Discovered validateQuery
$validateQuery
db#> [1] "SELECT 1"
Validate connection
$validateCon()
db#> DCtr | Connection valid true
#> [1] TRUE
If required, validateQuery can be defined manually.
$validateQuery <- "SELECT 2"
db$validateCon()
db#> DCtr | Connection valid true
#> [1] TRUE
$print()
db#> object
#> id null
#> verbose true
#> validateQuery SELECT 2
#> database
#> package RSQLite
#> dbname :memory:
#> status
#> driver true
#> connection true
#> transaction false
#> result false
Clean up
$disconnect()
db#> Dctr | Database disconnected
$validateCon()
db#> Dctr | Connection valid false
#> [1] FALSE
$unloadDriver()
db#> dctr | Driver unload RSQLite
Please read the documentation of rocker class.
help("rocker-package")
help("rocker-R6-class")
help("rocker-S3-functions")
help("rocker-README")
Reading of DBI package documentation is recommended.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.