You're mistaking dbSendQuery
with dbGetQuery
.
dbGetQuery
combine dbSendQuery
, fetch
and dbClearResult
as per documentation:
The function
dbSendQuery
only submits and synchronously executes the SQL statement to the database engine. It does not extracts any records — for that you need to use the functionfetch
(make sure you invokedbClearResult
when you finish fetching the records you need).The function
dbGetQuery
does all these in one operation (submits the statement, fetches all output records, and clears the result set).
From ?dbGetQuery
in package DBI
.