Although rocker is a R6 class, functions can be also accesses in classical S3 way.
S3 example
library(rocker)
<- newDB()
db #> dctr | New object
setupDriver(db, drv = RSQLite::SQLite(), dbname = ":memory:")
#> Dctr | Driver load RSQLite
connect(db)
#> DCtr | Database connected
writeTable(db, "mtcars", mtcars)
#> DCtr | Write table mtcars columns mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb rows 32
sendQuery(db, "SELECT * FROM mtcars;")
#> DCtR | Send query 21 characters
<- fetch(db)
output #> DCtR | Fetch rows all -> Received 32 rows, 11 columns, 4824 bytes
clearResult(db)
#> DCtr | Clear result
disconnect(db)
#> Dctr | Database disconnected
unloadDriver(db)
#> dctr | Driver unload RSQLite
R6 example
<- rocker::newDB()
db #> dctr | New object
$setupDriver(drv = RSQLite::SQLite(), dbname = ":memory:")
db#> Dctr | Driver load RSQLite
$connect()
db#> DCtr | Database connected
$writeTable("mtcars", mtcars)
db#> DCtr | Write table mtcars columns mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb rows 32
$sendQuery("SELECT * FROM mtcars;")
db#> DCtR | Send query 21 characters
<- db$fetch()
output #> DCtR | Fetch rows all -> Received 32 rows, 11 columns, 4824 bytes
$clearResult()
db#> DCtr | Clear result
$disconnect()
db#> Dctr | Database disconnected
$unloadDriver()
db#> dctr | Driver unload RSQLite