build_query is a slightly revised version of build_query in dplyr, and the difference is basically the change from limit parameter to top papameter.
the problem is, most verbs in dplyr such as select, filter, setdiff will call update, which in turn will call build_query, but the build_query is just an ordinary function, not a generic function, and because of the namespace mechanism, the build_query called in these verbs is dplyr:::build_query, not RSQLServer:::build_query. At present, RSQLServer:::build_query is just called by RSQLServer:::head, as it's defined in RSQLServer.
to solve the confict between top and limit, it's not neccensary to keep a RSQLServer version of build_query. it will work that using limit parameter to generate TOP keyword in select or FETCH clause depending on whether offset is not null and db.version>=11 in sql_select.SQLServerConnection, like this,
if (!is.null(limit)) {
assertthat::assert_that(assertthat::is.number(limit))
limit <- build_sql("TOP ", dplyr::escape(limit))
}
assertthat::assert_that(is.character(select), length(select) > 0L)
out$select <- dplyr::build_sql("SELECT ", limit, " ",
dplyr::escape(select, collapse = ", ", con = con))
assertthat::assert_that(assertthat::is.string(from))
out$from <- dplyr::build_sql("FROM ", from, con = con)
if to include a RSQLServer version of build_query is neccesary, it's better to have a method of update for SQLServerConnection.