[R-pkg-devel] Weird error message during R CMD Check
martiankabe at gmail.com
martiankabe at gmail.com
Tue Mar 13 21:53:56 CET 2018
Hello,
I'm trying to submit my package to CRAN but receiving the following error
message.
object 'connectionString' not found
even if it is parameter of get_DB_info(connectionString) function - see the
function definition below error message.
Please, can you help me to understand what should be fixed in the code so
that I could successfully submit my package to CRAN?
Thanks a lot for any of your help in advance.
Best,
Martin
https://win-builder.r-project.org/incoming_pretest/180313_212715_RSQLS_16/00
check.log
* checking examples ...
** running examples for arch 'i386' ... ERROR
Running examples in 'RSQLS-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: get_DB_info
> ### Title: Get database info
> ### Aliases: get_DB_info
>
> ### ** Examples
>
> get_DB_info(connectionString)
Error in paste("", pathtocsvloader, " ", connectionString, " ", sql_task, :
object 'connectionString' not found
Calls: get_DB_info -> paste
Execution halted
** running examples for arch 'x64' ... ERROR
Running examples in 'RSQLS-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: get_DB_info
> ### Title: Get database info
> ### Aliases: get_DB_info
>
> ### ** Examples
>
> get_DB_info(connectionString)
Error in paste("", pathtocsvloader, " ", connectionString, " ", sql_task, :
object 'connectionString' not found
Calls: get_DB_info -> paste
Execution halted
* checking PDF version of manual ... OK
* DONE
Status: 2 ERRORs, 3 WARNINGs, 4 NOTEs
------------------------------------ get_DB_info(connectionString)
------------------------------------------------------------
#' Get database info
#'
#' This function retrieves basic info about database defined
#' in SQL Server connection string.
#' @param connectionString Connection string to SQL server
#' @return Returns data.frame and data.table
#' @export
#' @examples
#' get_DB_info(connectionString)
#' @note How to set up SQL Server connection string see
\link{set_connString}. Be also sure you have a permissions for access to
sys.dm_db_index_usage_stats:
#' check it with SELECT * FROM sys.dm_db_index_usage_stats. If not, contact
your SQL Server admin.
get_DB_info <- function(connectionString) {
options(scipen=999)
if (missing(connectionString)) {
print("Connection string is missing!")
return("Try it again")
}
pathtocsvloader <- gsub("/","\\\\",paste(system.file(package =
"RSQLS")[1],"/Loader/csv_to_sql_loader.exe", sep = ""))
pathtocsvloader <- replace_spaced_words(pathtocsvloader)
pathtocsvloader <- gsub('.{1}$', '', pathtocsvloader)
# logic for pathtocsvfiles variable
pathtocsvfiles <- gsub("/","\\\\",paste(system.file(package =
"RSQLS")[1],"/Data/", sep = ""))
if (!endsWith(pathtocsvfiles, "\\")) {
pathtocsvfiles <- paste(pathtocsvfiles,"\\", sep = "")
}
sqltabname <- "tempDBInfo"
sqltabname <- gsub("\\[|\\]", "", sqltabname)
if (length(strsplit(sqltabname,"\\.")[[1]]) > 1) {
sqltabname_prev <- gsub("^[^.]*.", "", sqltabname)
} else {
sqltabname_prev <- sqltabname
}
sql_tab_name <- paste('"', sqltabname, '"', sep = "") #
'"dbo.CFTC_Disaggregated_Raw_test"'
sql_task <- paste('"dbinfo"', sep = "")
real_pathtocsvfile <- paste('"', pathtocsvfiles, paste(sqltabname_prev,
".csv", sep = ""),'"', sep = "")
file_to_be_deleted <- paste(pathtocsvfiles, paste(sqltabname_prev, ".csv",
sep = ""), sep = "")
ss <- paste('', pathtocsvloader, " ", connectionString, " ", sql_task, "
", real_pathtocsvfile, " ", "null", sep = "")
# Call shell command
oldw <- getOption("warn")
options(warn = -1)
sc <- shell(ss)
if (file.exists(file_to_be_deleted)){
out <- data.table::fread(file_to_be_deleted, stringsAsFactors = FALSE,
sep = "~", fill = TRUE)
} else{
options(warn = oldw)
stop('See the previous messages for more details.')
}
# Delete csv file
if (file.exists(file_to_be_deleted)){
invisible(file.remove(file_to_be_deleted))
} else{
options(warn = oldw)
stop('See the previous messages for more details.')
}
if( sc == 1 ) {
options(warn = oldw)
stop('See the previous messages for more details.')
} else {
options(warn = oldw)
}
return(out)
}
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list