R 首先添加它们。(我只是指出在这种情况下的错误,但实际上,有几种方法可以更安全、更优雅地构建sql请求)谢谢,这是Tim Biegeleisen的paste0()解决方案与此的结合 sqlfunction <- function(text){ sql

R 首先添加它们。(我只是指出在这种情况下的错误,但实际上,有几种方法可以更安全、更优雅地构建sql请求)谢谢,这是Tim Biegeleisen的paste0()解决方案与此的结合 sqlfunction <- function(text){ sql,r,shiny,R,Shiny,首先添加它们。(我只是指出在这种情况下的错误,但实际上,有几种方法可以更安全、更优雅地构建sql请求)谢谢,这是Tim Biegeleisen的paste0()解决方案与此的结合 sqlfunction <- function(text){ sqlQuery(conn, stri_paste("select .... where product_code in (", text, ");")) } toString(sprintf("'%s'", unlist(strsplit(in


首先添加它们。(我只是指出在这种情况下的错误,但实际上,有几种方法可以更安全、更优雅地构建sql请求)谢谢,这是Tim Biegeleisen的paste0()解决方案与此的结合
sqlfunction <- function(text){

sqlQuery(conn, stri_paste("select .... where product_code in (", text, ");"))

}
toString(sprintf("'%s'", unlist(strsplit(input$text_input, ","))))
text_input = "A,B,C"
in_clause <- paste0("'", unlist(strsplit(text_input, ",")), "'", collapse=",")
sql <- paste0("WHERE product_code IN (", in_clause, ")")
sql

[1] "WHERE product_code IN ('A','B','C')"