
  
## ------------------------------ ##
##        QUERY EXECUTION         ##
## ------------------------------ ##


  limit <- if (is.numeric(TEST.RUN)) TEST.RUN else if(isTRUE(TEST.RUN)) 10 else NULL

  if (length(schema) > 1 && length(schema) == length(TBL) ) 
    warning ("\n `schema` and `TBL` each have multiple lengths and will result in ", length(TBL) * length(schema) ," total tables queried.\nTo create schema/TBL combinations in parallel, use `mapply`.")

  if (length(schema)) {
    TBL    <- sapply(schema, schemaPaste, TBL)
    schema <- NULL
  }

  # Note: This was the original idea, but quickly became evident that the 
  #  data is too large to be moving it in and out of a list.  
  #  QRES is no longer being used. 
  #### Queries will be saved in a list. 
  ##     QRY holds the string sent as the SQL Query
  ##    QRES holds the results that were returned by the query
  ##    q.nm is the list names that correspons to both of these
  ## 
  if (!exists("QRY"))
    QRY <- list()

  # ------------------------------------------------------------------------------------------- #
  #                            C O N S T R U C T                                                #
  # ------------------------------------------------------------------------------------------- #

  qry_timestamp <- timeStamp(frmt=frmt.monthday_time)

  q.nm <- paste0(q.nm.prefx, TBL, "_UPC_", if(length(schema)) paste0(schema, "_"), qry_timestamp)
  # Construct the query

  QRY[q.nm] <- sapply(TBL, makeQry
                      , colsToPull=colsToPull, whereIn=whereIn, schema=schema
                      , dateCol=date_col, dateMin=dateMin, dateMax=dateMax
                      , limit=limit, useProduction=useProduction
                      , prependCols=prependCols
                      , lte=lte, gte=gte)


  # ------------------------------------------------------------------------------------------- #
  #                            E X E C U T E
  # ------------------------------------------------------------------------------------------- #

{

  if (length(QRY[q.nm]) > 1 || length(q.nm) > 1) 
    stop ("Length of QRY is larger than one, and cannot process.")

  # Submit the qruery and store the results
  try(dbDisconnect(con), silent=TRUE)
  con    <- getDB(drv.str="PostgreSQL")
  DB.raw <- runQry(QRY[[q.nm]], verbose=TRUE, verbose.max.lines=15L, verbose.max.width=110L)

  ## ------------------------------ ##
  try(dbDisconnect(con), silent=TRUE)
  try(detach(package:RPostgreSQL), silent=TRUE)
  ## ------------------------------ ##


}

