# Submitted to OSEHRA 05/25/2017 by Jihwan Park.
# Original routine authored by Jihwan Park 2017.

## checkDB.R : check tables for initial update

checkTables <- function(...) {
  require("RMySQL")
  # connect DB
  mydb = dbConnect(MySQL(), user='shiny', password='shiny', dbname='CDSS', host='localhost')
  isTB1 = dbExistsTable(mydb, name = 'TB_CYBERKNIFE')
  isTB2 = dbExistsTable(mydb, name = 'TB_CYBERKNIFE_CLEAN')
  dbDisconnect(mydb)
  if ( isTB1 & isTB2 )
    retVal = 0 # no need to initial loading
  else
    retVal = 1 # need to initial loading
  return(retVal)
}

