I want to check a condition in Shiny app whether mysql table exist or not in specific databse. If table does not exist it should return a null value. Here is my code looking like.
loadData <- function(){
db <- dbConnect(MySQL(), dbname = databaseName, host = host,
port = port, user = user, password = password)
res <- dbSendQuery(db, "SELECT * FROM some_table")
final_data <- dbFetch(res)
dbDisconnect(db)
return(final_data)
}
I want to handle exception thrown by dbSendQuery(db, "SELECT * FROM some_table")
if some_table
does not exist in databse.
Please help..