in R/R/storedProcedure.R [314:358]
executeSproc <- function(connectionString, name, ..., getScript = FALSE)
{
if (class(name) != "character")
stop("the argument must be the name of a Sproc")
res <- createQuery(connectionString = connectionString, name = name, ...)
query <- res$query
paramOrder <- res$inputParams
paramList = list(...)
if (getScript)
{
return(query)
}
# Reorder the parameters to match the function param order
#
if (length(paramList) > 0)
{
paramList <- paramList[paramOrder]
}
if (length(paramList) > 0)
{
result <- execute(connectionString, query, paramList)
}
else
{
result <- execute(connectionString, query)
}
if (is.list(result))
{
return(result)
}
else if (!is.character(result))
{
stop(paste("Error executing the stored procedure:", name))
}
else
{
return(NULL)
}
}