File: dbIsValid.Rd

package info (click to toggle)
dbi 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,004 kB
  • sloc: makefile: 2
file content (124 lines) | stat: -rw-r--r-- 4,055 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dbIsValid.R
\name{dbIsValid}
\alias{dbIsValid}
\title{Is this DBMS object still valid?}
\usage{
dbIsValid(dbObj, ...)
}
\arguments{
\item{dbObj}{An object inheriting from \linkS4class{DBIObject},
i.e. \linkS4class{DBIDriver}, \linkS4class{DBIConnection},
or a \linkS4class{DBIResult}}

\item{...}{Other arguments to methods.}
}
\value{
\code{dbIsValid()} returns a logical scalar,
\code{TRUE} if the object specified by \code{dbObj} is valid,
\code{FALSE} otherwise.
A \linkS4class{DBIConnection} object is initially valid,
and becomes invalid after disconnecting with \code{\link[=dbDisconnect]{dbDisconnect()}}.
For an invalid connection object (e.g., for some drivers if the object
is saved to a file and then restored), the method also returns \code{FALSE}.
A \linkS4class{DBIResult} object is valid after a call to \code{\link[=dbSendQuery]{dbSendQuery()}},
and stays valid even after all rows have been fetched;
only clearing it with \code{\link[=dbClearResult]{dbClearResult()}} invalidates it.
A \linkS4class{DBIResult} object is also valid after a call to \code{\link[=dbSendStatement]{dbSendStatement()}},
and stays valid after querying the number of rows affected;
only clearing it with \code{\link[=dbClearResult]{dbClearResult()}} invalidates it.
If the connection to the database system is dropped (e.g., due to
connectivity problems, server failure, etc.), \code{dbIsValid()} should return
\code{FALSE}. This is not tested automatically.
}
\description{
This generic tests whether a database object is still valid (i.e. it hasn't
been disconnected or cleared).

\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbIsValid")}
}
\examples{
\dontshow{if (requireNamespace("RSQLite", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
dbIsValid(RSQLite::SQLite())

con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbIsValid(con)

rs <- dbSendQuery(con, "SELECT 1")
dbIsValid(rs)

dbClearResult(rs)
dbIsValid(rs)

dbDisconnect(con)
dbIsValid(con)
\dontshow{\}) # examplesIf}
}
\seealso{
Other DBIDriver generics: 
\code{\link{DBIDriver-class}},
\code{\link{dbCanConnect}()},
\code{\link{dbConnect}()},
\code{\link{dbDataType}()},
\code{\link{dbDriver}()},
\code{\link{dbGetInfo}()},
\code{\link{dbIsReadOnly}()},
\code{\link{dbListConnections}()}

Other DBIConnection generics: 
\code{\link{DBIConnection-class}},
\code{\link{dbAppendTable}()},
\code{\link{dbAppendTableArrow}()},
\code{\link{dbCreateTable}()},
\code{\link{dbCreateTableArrow}()},
\code{\link{dbDataType}()},
\code{\link{dbDisconnect}()},
\code{\link{dbExecute}()},
\code{\link{dbExistsTable}()},
\code{\link{dbGetException}()},
\code{\link{dbGetInfo}()},
\code{\link{dbGetQuery}()},
\code{\link{dbGetQueryArrow}()},
\code{\link{dbIsReadOnly}()},
\code{\link{dbListFields}()},
\code{\link{dbListObjects}()},
\code{\link{dbListResults}()},
\code{\link{dbListTables}()},
\code{\link{dbQuoteIdentifier}()},
\code{\link{dbReadTable}()},
\code{\link{dbReadTableArrow}()},
\code{\link{dbRemoveTable}()},
\code{\link{dbSendQuery}()},
\code{\link{dbSendQueryArrow}()},
\code{\link{dbSendStatement}()},
\code{\link{dbUnquoteIdentifier}()},
\code{\link{dbWriteTable}()},
\code{\link{dbWriteTableArrow}()}

Other DBIResult generics: 
\code{\link{DBIResult-class}},
\code{\link{dbBind}()},
\code{\link{dbClearResult}()},
\code{\link{dbColumnInfo}()},
\code{\link{dbFetch}()},
\code{\link{dbGetInfo}()},
\code{\link{dbGetRowCount}()},
\code{\link{dbGetRowsAffected}()},
\code{\link{dbGetStatement}()},
\code{\link{dbHasCompleted}()},
\code{\link{dbIsReadOnly}()},
\code{\link{dbQuoteLiteral}()},
\code{\link{dbQuoteString}()}

Other DBIResultArrow generics: 
\code{\link{DBIResultArrow-class}},
\code{\link{dbBind}()},
\code{\link{dbClearResult}()},
\code{\link{dbFetchArrow}()},
\code{\link{dbFetchArrowChunk}()},
\code{\link{dbHasCompleted}()}
}
\concept{DBIConnection generics}
\concept{DBIDriver generics}
\concept{DBIResult generics}
\concept{DBIResultArrow generics}