diff --git a/NAMESPACE b/NAMESPACE index ac1a26e..6232b2d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,10 +1,10 @@ -# Generated by roxygen2: do not edit by hand - -export(odbcFetchRows) -export(odbcGetQueryTimeout) -export(odbcSetQueryTimeout) -export(sqlExecute) -export(sqlFetchMore) -export(sqlPrepare) -import(RODBC) -useDynLib(RODBCext) +# Generated by roxygen2: do not edit by hand + +export(odbcFetchRows) +export(odbcGetQueryTimeout) +export(odbcSetQueryTimeout) +export(sqlExecute) +export(sqlFetchMore) +export(sqlPrepare) +import(RODBC) +useDynLib(RODBCext) diff --git a/cran-comments.md b/cran-comments.md index 0775fcc..b37e041 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,9 +1,9 @@ ## Test environments -* local Linux install, x64, R 3.3.2 -* local Windows install, x64, R 3.3.3 -* travis.ci Linux, x64, R 3.3.3 -* travis.ci Linux, x64, R 3.4.0 beta (r72499) +* local Linux install, x64, R 3.4.1 +* local Windows install, x64, R 3.4.1 +* travis.ci Linux, x64, R 3.4.1 +* travis.ci Linux, x64, R 3.5.0 unstable (r72992) * devtools win-builder, R 3.4.0 beta (r72499) ## R CMD check results diff --git a/man/odbcFetchRows.Rd b/man/odbcFetchRows.Rd index 4c5be3e..9ad90fe 100644 --- a/man/odbcFetchRows.Rd +++ b/man/odbcFetchRows.Rd @@ -1,21 +1,21 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/odbcFetchRows.R -\name{odbcFetchRows} -\alias{odbcFetchRows} -\title{Overlay over \link[RODBC]{odbcFetchRows}} -\usage{ -odbcFetchRows(channel, ...) -} -\arguments{ -\item{channel}{ODBC connection obtained by \link{odbcConnect}} - -\item{...}{other parametrs passed to \link[RODBC]{odbcFetchRows}} -} -\value{ -see \link[RODBC]{odbcFetchRows} -} -\description{ -RODBC::odbcFetchRows crashes if the ODBC channel is in "query prepared -but already not executed" state. -This function is a small overlay emmitting an error in such a case. -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/odbcFetchRows.R +\name{odbcFetchRows} +\alias{odbcFetchRows} +\title{Overlay over \link[RODBC]{odbcFetchRows}} +\usage{ +odbcFetchRows(channel, ...) +} +\arguments{ +\item{channel}{ODBC connection obtained by \link{odbcConnect}} + +\item{...}{other parametrs passed to \link[RODBC]{odbcFetchRows}} +} +\value{ +see \link[RODBC]{odbcFetchRows} +} +\description{ +RODBC::odbcFetchRows crashes if the ODBC channel is in "query prepared +but already not executed" state. +This function is a small overlay emmitting an error in such a case. +} diff --git a/man/odbcGetQueryTimeout.Rd b/man/odbcGetQueryTimeout.Rd index 8481918..07722a3 100644 --- a/man/odbcGetQueryTimeout.Rd +++ b/man/odbcGetQueryTimeout.Rd @@ -1,33 +1,33 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/odbcGetQueryTimeout.R -\name{odbcGetQueryTimeout} -\alias{odbcGetQueryTimeout} -\title{Gets the current query timeout of a prepared query} -\usage{ -odbcGetQueryTimeout(channel) -} -\arguments{ -\item{channel}{an RODBC channel containing an open connection} -} -\value{ -The current query timeout value in seconds. 0 means "no timeout" -} -\description{ -A query has to be already prepared using SQLPrepare() - -Throws an error if an error occured -} -\examples{ -\dontrun{ - conn = odbcConnect('MyDataSource') - - sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") - odbcGetQueryTimeout(conn) # shows the current query timeout of the prepared statement - sqlExecute(conn, 'myValue') - sqlFetchMore(conn) -} -} -\seealso{ -\code{\link{odbcSetQueryTimeout}}, \code{\link{odbcConnect}}, - \code{\link{odbcDriverConnect}} -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/odbcGetQueryTimeout.R +\name{odbcGetQueryTimeout} +\alias{odbcGetQueryTimeout} +\title{Gets the current query timeout of a prepared query} +\usage{ +odbcGetQueryTimeout(channel) +} +\arguments{ +\item{channel}{an RODBC channel containing an open connection} +} +\value{ +The current query timeout value in seconds. 0 means "no timeout" +} +\description{ +A query has to be already prepared using SQLPrepare() + +Throws an error if an error occured +} +\examples{ +\dontrun{ + conn = odbcConnect('MyDataSource') + + sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") + odbcGetQueryTimeout(conn) # shows the current query timeout of the prepared statement + sqlExecute(conn, 'myValue') + sqlFetchMore(conn) +} +} +\seealso{ +\code{\link{odbcSetQueryTimeout}}, \code{\link{odbcConnect}}, + \code{\link{odbcDriverConnect}} +} diff --git a/man/odbcSetQueryTimeout.Rd b/man/odbcSetQueryTimeout.Rd index cb760ef..70e9ce0 100644 --- a/man/odbcSetQueryTimeout.Rd +++ b/man/odbcSetQueryTimeout.Rd @@ -1,40 +1,40 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/odbcSetQueryTimeout.R -\name{odbcSetQueryTimeout} -\alias{odbcSetQueryTimeout} -\title{Sets the query timeout of a prepared query} -\usage{ -odbcSetQueryTimeout(channel, timeout = 0) -} -\arguments{ -\item{channel}{an open RODBC channel (connection)} - -\item{timeout}{the new query timeout value in seconds (0 means "no timeout")} -} -\value{ -0 = success, 1 = success but with an info message, -} -\description{ -A query has to be already prepared using SQLPrepare() - -Throws an error if any error occured -} -\note{ -Not all drivers will support a query timeout. You may get an error then - or the query timeout values remains unchanged silently. -} -\examples{ -\dontrun{ - conn = odbcConnect('MyDataSource') - - sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") - odbcSetQueryTimeout(conn, 120) # sets the query timeout of the prepared statement - sqlExecute(conn, 'myValue') - sqlFetchMore(conn) -} - -} -\seealso{ -\code{\link{odbcGetQueryTimeout}}, \code{\link{odbcConnect}}, - \code{\link{odbcDriverConnect}} -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/odbcSetQueryTimeout.R +\name{odbcSetQueryTimeout} +\alias{odbcSetQueryTimeout} +\title{Sets the query timeout of a prepared query} +\usage{ +odbcSetQueryTimeout(channel, timeout = 0) +} +\arguments{ +\item{channel}{an open RODBC channel (connection)} + +\item{timeout}{the new query timeout value in seconds (0 means "no timeout")} +} +\value{ +0 = success, 1 = success but with an info message, +} +\description{ +A query has to be already prepared using SQLPrepare() + +Throws an error if any error occured +} +\note{ +Not all drivers will support a query timeout. You may get an error then + or the query timeout values remains unchanged silently. +} +\examples{ +\dontrun{ + conn = odbcConnect('MyDataSource') + + sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") + odbcSetQueryTimeout(conn, 120) # sets the query timeout of the prepared statement + sqlExecute(conn, 'myValue') + sqlFetchMore(conn) +} + +} +\seealso{ +\code{\link{odbcGetQueryTimeout}}, \code{\link{odbcConnect}}, + \code{\link{odbcDriverConnect}} +} diff --git a/man/sqlExecute.Rd b/man/sqlExecute.Rd index c00705d..f058bc0 100644 --- a/man/sqlExecute.Rd +++ b/man/sqlExecute.Rd @@ -1,86 +1,86 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sqlExecute.R -\name{sqlExecute} -\alias{sqlExecute} -\title{Executes an already prepared query} -\usage{ -sqlExecute(channel, query = NULL, data = NULL, fetch = FALSE, - errors = TRUE, rows_at_time = attr(channel, "rows_at_time"), - force_loop = FALSE, query_timeout = NULL, ...) -} -\arguments{ -\item{channel}{ODBC connection obtained by \link[RODBC]{odbcConnect}} - -\item{query}{a query string (NULL if query already prepared using -\link{sqlPrepare})} - -\item{data}{data to pass to sqlExecute (as data.frame)} - -\item{fetch}{whether to automatically fetch results (if data provided)} - -\item{errors}{whether to display errors} - -\item{rows_at_time}{number of rows to fetch at one time - see details of -\link[RODBC]{sqlQuery}} - -\item{force_loop}{whether to execute queries in the explicit loop with -separate query planing for each iteration (usefull if executing a query -invalidates its plan, e.g. EXEC queries on Ms SQL Server)} - -\item{query_timeout}{the query timeout value in seconds -(0 means "no timeout", NULL does not change the default value)} - -\item{...}{parameters to pass to \link[RODBC]{sqlGetResults} (if fetch=TRUE)} -} -\value{ -see datails -} -\description{ -Executes a parameterized query. - -Optionally (fetch=TRUE) fetches results using \link[RODBC]{sqlGetResults}. - -Optionally (query=NULL) uses query already prepared by \link{sqlPrepare}. -} -\details{ -Return value depends on the combination of parameters: -\itemize{ - \item if there were errors during query preparation or execution or fetching results - return value depends on errors parameter - if errors=TRUE error is thrown, - otherwise -1 will be returned - \item if fetch=FALSE and there were no errors invisible(1) will be returned - \item if fetch=TRUE and there were no errors a data.frame with results will be returned -} -} -\examples{ -\dontrun{ - conn = odbcConnect('MyDataSource') - - # prepare, execute and fetch results separatly - sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") - sqlExecute(conn, NULL, 'myValue') - sqlGetResults(conn) - - # prepare and execute at one time, fetch results separately - sqlExecute(conn, "SELECT * FROM myTable WHERE column = ?", 'myValue') - sqlGetResults(conn) - - # prepare, execute and fetch at one time - sqlExecute(conn, "SELECT * FROM myTable WHERE column = ?", 'myValue', TRUE) - - # prepare, execute and fetch at one time, pass additional parameters to sqlFetch() - sqlExecute( - conn, - "SELECT * FROM myTable WHERE column = ?", - 'myValue', - TRUE, - stringsAsFactors=FALSE - ) - - # prepare, execute and fetch at one time using a query timeout value - sqlExecute(conn, "SELECT * FROM myTable WHERE column = ?", 'myValue', TRUE, query_timeout=45) - - # execute a simple statement without parameters using a query timeout value - sqlExecute(con, "SELECT * FROM myTable", fetch = TRUE, query_timeout = 60) -} -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sqlExecute.R +\name{sqlExecute} +\alias{sqlExecute} +\title{Executes an already prepared query} +\usage{ +sqlExecute(channel, query = NULL, data = NULL, fetch = FALSE, + errors = TRUE, rows_at_time = attr(channel, "rows_at_time"), + force_loop = FALSE, query_timeout = NULL, ...) +} +\arguments{ +\item{channel}{ODBC connection obtained by \link[RODBC]{odbcConnect}} + +\item{query}{a query string (NULL if query already prepared using +\link{sqlPrepare})} + +\item{data}{data to pass to sqlExecute (as data.frame)} + +\item{fetch}{whether to automatically fetch results (if data provided)} + +\item{errors}{whether to display errors} + +\item{rows_at_time}{number of rows to fetch at one time - see details of +\link[RODBC]{sqlQuery}} + +\item{force_loop}{whether to execute queries in the explicit loop with +separate query planing for each iteration (usefull if executing a query +invalidates its plan, e.g. EXEC queries on Ms SQL Server)} + +\item{query_timeout}{the query timeout value in seconds +(0 means "no timeout", NULL does not change the default value)} + +\item{...}{parameters to pass to \link[RODBC]{sqlGetResults} (if fetch=TRUE)} +} +\value{ +see datails +} +\description{ +Executes a parameterized query. + +Optionally (fetch=TRUE) fetches results using \link[RODBC]{sqlGetResults}. + +Optionally (query=NULL) uses query already prepared by \link{sqlPrepare}. +} +\details{ +Return value depends on the combination of parameters: +\itemize{ + \item if there were errors during query preparation or execution or fetching results + return value depends on errors parameter - if errors=TRUE error is thrown, + otherwise -1 will be returned + \item if fetch=FALSE and there were no errors invisible(1) will be returned + \item if fetch=TRUE and there were no errors a data.frame with results will be returned +} +} +\examples{ +\dontrun{ + conn = odbcConnect('MyDataSource') + + # prepare, execute and fetch results separatly + sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") + sqlExecute(conn, NULL, 'myValue') + sqlGetResults(conn) + + # prepare and execute at one time, fetch results separately + sqlExecute(conn, "SELECT * FROM myTable WHERE column = ?", 'myValue') + sqlGetResults(conn) + + # prepare, execute and fetch at one time + sqlExecute(conn, "SELECT * FROM myTable WHERE column = ?", 'myValue', TRUE) + + # prepare, execute and fetch at one time, pass additional parameters to sqlFetch() + sqlExecute( + conn, + "SELECT * FROM myTable WHERE column = ?", + 'myValue', + TRUE, + stringsAsFactors=FALSE + ) + + # prepare, execute and fetch at one time using a query timeout value + sqlExecute(conn, "SELECT * FROM myTable WHERE column = ?", 'myValue', TRUE, query_timeout=45) + + # execute a simple statement without parameters using a query timeout value + sqlExecute(con, "SELECT * FROM myTable", fetch = TRUE, query_timeout = 60) +} +} diff --git a/man/sqlFetchMore.Rd b/man/sqlFetchMore.Rd index e21620f..302ce81 100644 --- a/man/sqlFetchMore.Rd +++ b/man/sqlFetchMore.Rd @@ -1,21 +1,21 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sqlFetchMore.R -\name{sqlFetchMore} -\alias{sqlFetchMore} -\title{Overlay over \link[RODBC]{sqlFetchMore}} -\usage{ -sqlFetchMore(channel, ...) -} -\arguments{ -\item{channel}{ODBC connection obtained by \link{odbcConnect}} - -\item{...}{other parametrs passed to \link[RODBC]{sqlFetchMore}} -} -\value{ -see \link[RODBC]{sqlFetchMore} -} -\description{ -RODBC::sqlFetchMore crashes if the ODBC channel is in "query prepared -but already not executed" state. -This function is a small overlay emmitting an error in such a case. -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sqlFetchMore.R +\name{sqlFetchMore} +\alias{sqlFetchMore} +\title{Overlay over \link[RODBC]{sqlFetchMore}} +\usage{ +sqlFetchMore(channel, ...) +} +\arguments{ +\item{channel}{ODBC connection obtained by \link{odbcConnect}} + +\item{...}{other parametrs passed to \link[RODBC]{sqlFetchMore}} +} +\value{ +see \link[RODBC]{sqlFetchMore} +} +\description{ +RODBC::sqlFetchMore crashes if the ODBC channel is in "query prepared +but already not executed" state. +This function is a small overlay emmitting an error in such a case. +} diff --git a/man/sqlPrepare.Rd b/man/sqlPrepare.Rd index 2c0ac55..067edda 100644 --- a/man/sqlPrepare.Rd +++ b/man/sqlPrepare.Rd @@ -1,37 +1,37 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sqlPrepare.R -\name{sqlPrepare} -\alias{sqlPrepare} -\title{Prepares a query for execution} -\usage{ -sqlPrepare(channel, query, errors = TRUE, query_timeout = NULL) -} -\arguments{ -\item{channel}{ODBC connection obtained by \link{odbcConnect}} - -\item{query}{query string} - -\item{errors}{whether to display errors} - -\item{query_timeout}{the query timeout value in seconds -(0 means "no timeout", NULL does not change the default value)} -} -\value{ -invisible(1) on success, -1 or an error (depending on errors parameter) on error -} -\description{ -Prepares a query for execution. -} -\examples{ -\dontrun{ - conn = odbcConnect('MyDataSource') - - sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") - sqlExecute(conn, NULL, 'myValue') - sqlFetchMore(conn) - - # with a query timeout - sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?", query_timeout=60) - sqlExecute(conn, data='myValue', fetch=TRUE) -} -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sqlPrepare.R +\name{sqlPrepare} +\alias{sqlPrepare} +\title{Prepares a query for execution} +\usage{ +sqlPrepare(channel, query, errors = TRUE, query_timeout = NULL) +} +\arguments{ +\item{channel}{ODBC connection obtained by \link{odbcConnect}} + +\item{query}{query string} + +\item{errors}{whether to display errors} + +\item{query_timeout}{the query timeout value in seconds +(0 means "no timeout", NULL does not change the default value)} +} +\value{ +invisible(1) on success, -1 or an error (depending on errors parameter) on error +} +\description{ +Prepares a query for execution. +} +\examples{ +\dontrun{ + conn = odbcConnect('MyDataSource') + + sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?") + sqlExecute(conn, NULL, 'myValue') + sqlFetchMore(conn) + + # with a query timeout + sqlPrepare(conn, "SELECT * FROM myTable WHERE column = ?", query_timeout=60) + sqlExecute(conn, data='myValue', fetch=TRUE) +} +}