Skip to content

dbExecute returns the last value when executing drop table #238

Description

@digitalwright

According to the documentation, dbExecute() is supposed to return the "number of rows affected by the statement". This tends to work, but it appears that when dropping a table dbExecute() instead returns the number of rows affected by the last call to dbExecute(). If no previous statements were executed then it returns 1 row affected independent of the number of rows in the table that was dropped.

con <- dbConnect(RSQLite::SQLite(), ":memory:")

data(USArrests)
dim(USArrests) # 50 rows

dbWriteTable(con, "USArrests", USArrests)

dbExecute(con, "delete from USArrests where UrbanPop < 50") # 8 rows deleted

dbExecute(con, "drop table USArrests") # 8 rows affected?

dbDisconnect(con)

This was on RSQlite v2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions