Skip to content

How to get the number of updated/deleted rows? #331

@paulocoutinhox

Description

@paulocoutinhox

Hi,

How i can get the number of affected rows for update/delete?

Example:

auto sql =
    "UPDATE todo SET "
    "title = :title, "
    "body = :body, "
    "data = :data, "
    "done = :done, "
    "updated_at = :updated_at "
    "WHERE id = :id";

auto application = std::static_pointer_cast<ApplicationCoreImpl>(ApplicationCore::shared());
auto db = application->getDB();

SQLite::Statement query(*db, sql);

query.bind(":id", id);
query.bind(":title", todo.title);
query.bind(":body", todo.body);
query.bind(":data", MapHelper::toJsonString(todo.data));
query.bind(":done", todo.done);
query.bind(":updated_at", DateTime::getStringFromDateTime(todo.updatedAt));
query.exec();

Thanks.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions