Languages

Menu
Sites
Language
Database: Get affected records count after DELELE / UPDATE

Hello !

I am working with database just as described in documentation:

    ...
    sql = L"UPDATE myTable1 SET column2 = 'Converted Data' WHERE column2 = 'Initial Data'";
    pDatabase->ExecuteSql(sql, true);
    ...

QUESTION:  How can I obtain a number of affected records after DELETE / UPDATE ?

Doc is silent about this... :(

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

4 Replies
maybe you should search Sqlite documentation something like "Select changes() ...etc" might work I have not tested it
Jin JIn
i am too. i can't update table. help me!!!!!!!!!!!!
kimi
HI, You can use "@@RowCount" to display the affected rows in the most recent SQL transaction. To get this implement the code immiditely after the corresponding transaction. Select @@RowCount from table; statement should do. Kimi.
Jin JIn
Thanks for your reply. Problem is database file position. Database file must exist in project data directory surely. But I was create database file in project resource directory. This is my mistake. String dbPath(App::GetInstance()->GetAppResourcePath() + L"db"); // error String dbPath(App::GetInstance()->GetAppRootPath() + L"db"); // success if database file exist in project resource directory, update statement are not performed .But select statement are performed. Thanks.