File: dbNextResult.Rd

package info (click to toggle)
rmysql 0.6.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 724 kB
  • ctags: 305
  • sloc: ansic: 3,135; sh: 22; makefile: 4
file content (63 lines) | stat: -rw-r--r-- 1,892 bytes parent folder | download | duplicates (4)
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
% $Id$
\name{dbNextResult}
\alias{dbNextResult}
\alias{dbMoreResults}
\title{Fetch next result set from an SQL script or stored procedure (experimental)}
\description{
  Fetches the next result set from the output of a multi-statement SQL 
  script or stored procedure; checkes whether there are additonal
  result sets to process.
}
\usage{
dbNextResult(con, ...)
dbMoreResults(con, ...)
}
\arguments{
  \item{con}{a connection object (see \code{\link[DBI]{dbConnect}}).}
  \item{...}{any additional arguments to be passed to the dispatched method}
}
\details{

  SQL scripts (i.e., multiple SQL statements separated by ';')
  and stored procedures oftentimes generate multiple result sets.  These
  DBI generic functions provide a means to process them sequentially.

  \code{dbNextResult} fetches the next result from the sequence of
  pending results sets;  \code{dbMoreResults} returns a logical to 
  indicate whether there are additional results to process.
}
\value{
  \code{dbNextResult} returns a result set or \code{NULL}.

  \code{dbMoreResults} returns a logical specifying whether or not there
  are additional result sets to process in the connection.
}
\section{Note}{
  Currently only the \code{\link{MySQL}} driver implements these methods.
  See 'methods?dbNextMethod'.
}
\seealso{
   \code{\link{MySQL}}
   \code{\link[DBI]{dbConnect}}
   \code{\link[DBI]{dbSendQuery}}
   \code{\link[DBI]{fetch}}
}

\examples{\dontrun{
rs1 <- dbSendQuery(con, 
         paste(
             "select Agent, ip\_addr, DATA from pseudo\_data order by Agent",
             "select * from Agent\_name",
              sep = ";")
         )
x1 <- fetch(rs1, n = -1)
if(dbMoreResults(con)){
   rs2 <- dbNextResult(con)
   x2 <- fetch(rs2, n = -1)
}
}
}
\keyword{programming}% at least one, from doc/KEYWORDS
\keyword{interface}% __ONLY ONE__ keyword per line
\keyword{database}
% vim: syntax=tex