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.
Setup database and a table with 32 rows.
<- rocker::newDB() # New database handling object
db #> dctr | New object
$setupSQLite() # Setup SQLite database
db#> Dctr | Driver load RSQLite
$connect() # Open connection
db#> DCtr | Database connected
$writeTable("mtcars", mtcars) # Create table for testing
db#> DCtr | Write table mtcars columns mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb rows 32
<- db$getQuery("SELECT * FROM mtcars;") # Get query -> 32 rows
output #> DCtR | Send query 21 characters
#> DCtR | Fetch rows all -> Received 32 rows, 11 columns, 4824 bytes
#> DCtR | Rows fetched 32
#> DCtR | Has completed yes
#> DCtr | Clear result
$transaction # Transaction indicator
db#> [1] FALSE
Starting with a table with 32 rows, begin transaction 1. Delete 15 rows and commit transaction. Operations results in a table with 17 rows.
$begin() # Start transaction 1
db#> DCTr | Transaction begin
$transaction # Transaction indicator
db#> [1] TRUE
<- db$execute("DELETE FROM mtcars WHERE gear = 3;") # Modify table -> 15 rows
AFFECTED #> DCTR | Send statement 34 characters
#> DCTR | Rows affected 15
#> DCTr | Clear result
$commit() # Commit transaction 1
db#> DCtr | Transaction commit
$transaction # Transaction indicator
db#> [1] FALSE
<- db$getQuery("SELECT * FROM mtcars;") # Get query -> 17 rows
output #> DCtR | Send query 21 characters
#> DCtR | Fetch rows all -> Received 17 rows, 11 columns, 3504 bytes
#> DCtR | Rows fetched 17
#> DCtR | Has completed yes
#> DCtr | Clear result
Starting with a table with 17 rows, begin transaction 2. Delete 5 rows and rollback transaction. Operations results in a table with 17 rows.
$begin() # Start transaction 2
db#> DCTr | Transaction begin
$transaction # Transaction indicator
db#> [1] TRUE
<- db$execute("DELETE FROM mtcars WHERE gear = 5;") # Modify table -> 5 rows
AFFECTED #> DCTR | Send statement 34 characters
#> DCTR | Rows affected 5
#> DCTr | Clear result
<- db$getQuery("SELECT * FROM mtcars;") # Get query -> 12 rows
output #> DCTR | Send query 21 characters
#> DCTR | Fetch rows all -> Received 12 rows, 11 columns, 3416 bytes
#> DCTR | Rows fetched 12
#> DCTR | Has completed yes
#> DCTr | Clear result
$rollback() # Rollback transaction 2
db#> DCtr | Transaction rollback
$transaction # Transaction indicator
db#> [1] FALSE
<- db$getQuery("SELECT * FROM mtcars;") # Get query -> 17 rows
output #> DCtR | Send query 21 characters
#> DCtR | Fetch rows all -> Received 17 rows, 11 columns, 3504 bytes
#> DCtR | Rows fetched 17
#> DCtR | Has completed yes
#> DCtr | Clear result
Clean up
$disconnect() # Close connection
db#> Dctr | Database disconnected
$unloadDriver() # Reset database handling object
db#> dctr | Driver unload RSQLite
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.