From: ilho159kim Date: Thu, 11 May 2023 06:11:42 +0000 (+0900) Subject: [Tdbc] Fix Sqlite update hook (#5251) X-Git-Tag: submit/tizen/20230511.064312~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a57a558dc8c834e615ebe0917b40c98090ccf84;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Tdbc] Fix Sqlite update hook (#5251) If the delete statement is executed, the record can't be returned because the value for the rowid doesn't exist in the database Therefore, in the case of delete, the record is returned to null Signed-off-by: ilho kim Co-authored-by: pjh9216 --- diff --git a/src/Tizen.Data.Tdbc.Driver.Sqlite/Tizen.Data.Tdbc.Driver.Sqlite/Connection.cs b/src/Tizen.Data.Tdbc.Driver.Sqlite/Tizen.Data.Tdbc.Driver.Sqlite/Connection.cs index 066897096..4381acaf8 100644 --- a/src/Tizen.Data.Tdbc.Driver.Sqlite/Tizen.Data.Tdbc.Driver.Sqlite/Connection.cs +++ b/src/Tizen.Data.Tdbc.Driver.Sqlite/Tizen.Data.Tdbc.Driver.Sqlite/Connection.cs @@ -62,7 +62,7 @@ namespace Tizen.Data.Tdbc.Driver.Sqlite { Open(new Uri(openString)); } - + public void Close() { if (_opened) @@ -92,7 +92,7 @@ namespace Tizen.Data.Tdbc.Driver.Sqlite Sql sql = new Sql(string.Format("SELECT * from {0} WHERE rowid = {1}", table_name, rowid)); using (IStatement stmt = CreateStatement()) { - IRecord record = stmt.ExecuteQuery(sql).FirstOrDefault(); + IRecord record = (operationType != OperationType.Delete ? stmt.ExecuteQuery(sql).FirstOrDefault() : null); RecordChangedEventArgs ev = new RecordChangedEventArgs(operationType, db_name, table_name, record); _recordChanged?.Invoke(this, ev); }