From: jeremy-jang <35089715+jeremy-jang@users.noreply.github.com> Date: Wed, 23 Aug 2023 23:16:56 +0000 (+0900) Subject: [Tdbc] Fix static analysis issue (#5497) X-Git-Tag: submit/tizen/20230824.040455~1^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa35eaccaa6227cfd67874932ab9e172cf40bed8;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Tdbc] Fix static analysis issue (#5497) Signed-off-by: Sangyoon Jang Co-authored-by: sukhyungkang <35091460+sukhyungkang@users.noreply.github.com> 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 cc0483751..8177fa272 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 @@ -89,13 +89,17 @@ namespace Tizen.Data.Tdbc.Driver.Sqlite break; } + if (operationType == OperationType.Delete) + return; + Sql sql = new Sql(string.Format("SELECT * from {0} WHERE rowid = {1}", table_name, rowid)); using (IStatement stmt = CreateStatement()) + using (IResultSet resultSet = stmt.ExecuteQuery(sql)) { - IRecord record = (operationType != OperationType.Delete ? stmt.ExecuteQuery(sql).FirstOrDefault() : null); - RecordChangedEventArgs ev = new RecordChangedEventArgs(operationType, db_name, table_name, record); + IRecord record = resultSet.FirstOrDefault(); lock (_lock) { + RecordChangedEventArgs ev = new RecordChangedEventArgs(operationType, db_name, table_name, record); _recordChanged?.Invoke(this, ev); } }