http://*.com/questions/21167070/how-to-query-multiple-times-and-close-the-connection-at-the-end
使用query1=dbSendQuery(db, "select * from table1")
会出现
Error in mysqlExecStatement(conn, statement, ...) : RS-DBI driver: (connection with pending rows, close resultSet before continuin
的错误,解决方案是
query1=dbGetQuery(db, "select * from table1")
Because:
The function ‘dbGetQuery’ does all these in one operation (submits the statement, fetches all output records, and clears the result set).