Learn R Programming

RSQLite (version 1.1-2)

sqlite-meta: Result information

Description

For a result object, returns information about the SQL statement used, the available columns and number of already fetched rows for a query, the number of affected rows for a statement, and the completion status.

Usage

# S4 method for SQLiteResult
dbColumnInfo(res, ...)

# S4 method for SQLiteResult dbGetRowsAffected(res, ...)

# S4 method for SQLiteResult dbGetRowCount(res, ...)

# S4 method for SQLiteResult dbHasCompleted(res, ...)

# S4 method for SQLiteResult dbGetStatement(res, ...)

Arguments

res

An object of class '>SQLiteResult

...

Ignored. Needed for compatibility with generic

See Also

The corresponding generic functions DBI::dbColumnInfo(), DBI::dbGetRowsAffected(), DBI::dbGetRowCount(), DBI::dbHasCompleted(), and DBI::dbGetStatement().

Examples

Run this code
# NOT RUN {
library(DBI)
db <- RSQLite::datasetsDb()
rs <- dbSendQuery(db, "SELECT * FROM USArrests WHERE UrbanPop >= 80")
dbGetStatement(rs)
dbColumnInfo(rs)
dbHasCompleted(rs)
dbGetRowCount(rs)

dbFetch(rs, n = 2)
dbHasCompleted(rs)
dbGetRowCount(rs)

invisible(dbFetch(rs))
dbHasCompleted(rs)
dbGetRowCount(rs)
dbClearResult(rs)

dbDisconnect(db)

con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbExecute(con, "CREATE TABLE test (a INTEGER)")
rs <- dbSendStatement(con, "INSERT INTO test VALUES (:a)", list(a = 1:3))
dbGetRowsAffected(rs)
dbClearResult(rs)
dbDisconnect(con)
# }

Run the code above in your browser using DataLab