## SPLITTING UP A PASTE OF LONG QUERIES

## This is fast and dirty 

split_qry <- function(qry, splitOn_no_regex=";", removeComments=TRUE) {
  if (removeComments)
    qry %<>% strsplit("\\n") %>% unlist %>% removeText("--.+$", .) %>% trim %>% removeNullsAndBlanksFromList %>% pasteC("\n") 

  funky <- "765tzsdfew390UKZllpqorRSTKLA9236879cneweoiP_"
  pat <- escapeRegEx(splitOn_no_regex) %>% sprintf("(%s)", .)
  repl <- paste0(funky, "\\1")
  gsub(pat=pat, repl=repl, x=qry) %>% 
      strsplit(split=funky) %>% 
      unlist %>% 
      removeNullsAndBlanksFromList
}