-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.R
47 lines (36 loc) · 1.13 KB
/
server.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
server <- function(input, output, session) {
# site <- reactive({
#
# input$host
# })
#
# user <- reactive({
# input$user
# })
table <- eventReactive(input$connecter,{
conn <- dbConnect(
drv = RMySQL::MySQL(),
dbname = input$database,
host = input$host,
username = input$user,
password = input$password)
on.exit(dbDisconnect(conn), add = TRUE)
dbGetQuery(conn,paste0(input$texting,";"))
})
# eventReactive(input$disconnect,{
# all_cons <- dbListConnections(MySQL())
# for(con in cons)
# dbDisconnect(con)
# })
output$tbl<-renderTable(table())
output$connectionlist <- eventReactive(input$list,{dbGetQuery(conn, "show processlist")})
tags$style(type="text/css",
".shiny-output-error { visibility: hidden; }",
".shiny-output-error:before { visibility: hidden; }"
)
output$downloadtwo <- downloadHandler(
filename = function() { paste(input$queryname,input$filetype,sep = "") },
content = function(file) {
write.csv(table(), file)
})
}