From fa35eaccaa6227cfd67874932ab9e172cf40bed8 Mon Sep 17 00:00:00 2001 From: jeremy-jang <35089715+jeremy-jang@users.noreply.github.com> Date: Thu, 24 Aug 2023 08:16:56 +0900 Subject: [PATCH] [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 --- .../Tizen.Data.Tdbc.Driver.Sqlite/Connection.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 cc04837..8177fa2 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); } } -- 2.7.4