From 0a57a558dc8c834e615ebe0917b40c98090ccf84 Mon Sep 17 00:00:00 2001 From: ilho159kim Date: Thu, 11 May 2023 15:11:42 +0900 Subject: [PATCH] [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 --- .../Tizen.Data.Tdbc.Driver.Sqlite/Connection.cs | 4 ++-- 1 file changed, 2 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 0668970..4381aca 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); } -- 2.7.4