Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery()

Writer Matthew Barrera

I would like to create a new database, which returns the results of a query as a dataframe. If I use dbExecute() or dbSendStatement(), as indicated in the warning message, it won't return the required dataframe. What can I do to remove this warning? Why am I getting these warnings?

drv <- RSQLite::dbDriver("SQLite")
con <- DBI::dbConnect(drv, dbname= tempfile())
DBI::dbGetQuery(con, paste("CREATE TABLE activity", "(aid INTEGER, cid INTEGER,", "activity INTEGER, score REAL)"))
# data frame with 0 columns and 0 rows
# Warning message:
# In result_fetch(res@ptr, n = n) :
# SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().

Thank you very much! :)

2 Related questions 0 getting error SQLCODE=-10, SQLSTATE=42603, SQLERRMC='), 0 r Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: no such column: csnu) 4 ORA-00900 error in dbSendStatement() of 'RJDBC' Related questions 0 getting error SQLCODE=-10, SQLSTATE=42603, SQLERRMC='), 0 r Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: no such column: csnu) 4 ORA-00900 error in dbSendStatement() of 'RJDBC' 0 SQL query is not working (Error in rsqlite_send_query) 8 Why does dbListTables give a warning message when called via a function? (R DBI) 1 How to avoid R errors while writing queries with single and double quotes 3 dbReadTable error in R: invalid object name 2 DBI::dbSendQuery fails with RJDBC::JDBC for SQL SERVER 13 Avoiding warning message “There is a result object still in use” when using dbSendQuery to create table on database 5 How do i fix the warning message "Closing open result set, cancelling previous query" when querying a PostgreSQL database in R? Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.