Skip to content

Commit

Permalink
Fixed error with backtick handling in select statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
timmarch committed Jun 26, 2016
1 parent 59de2bd commit cfc493e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/getSymbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ function(Symbols,env,return.class='xts',
}

if (!is.null(from) & !is.null(to)) {
query <- paste("SELECT ", paste(db.fields, collapse = ","), " FROM `", Symbols[[i]], "` WHERE date >= '", from, "' AND date <= '", to, "' ORDER BY date")
query <- paste("SELECT ", paste(db.fields, collapse = ","), " FROM ", paste("`", Symbols[[i]], "`", sep = ""), " WHERE date >= '", from, "' AND date <= '", to, "' ORDER BY date")
} else {
query <- paste("SELECT ", paste(db.fields, collapse = ","), " FROM `", Symbols[[i]], "` WHERE date ORDER BY date")
query <- paste("SELECT ", paste(db.fields, collapse = ","), " FROM ", paste("`", Symbols[[i]], "`", sep = ""), " WHERE date ORDER BY date")
}

rs <- DBI::dbSendQuery(con, query)
Expand Down

0 comments on commit cfc493e

Please sign in to comment.