From 1bb0407739165555142e495682eaeb1d56141270 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Mon, 18 Dec 2023 12:36:57 +0900 Subject: [PATCH] Fix Exec function to determine the cause of failure If the sqlite3_prepare_v2 function fails when execute Exec function the cause of failure can't get from the Result Pass the db handle to the Result so that an error message can be obtained from the db handle Change-Id: I340e3ee2ccacc6194c33fc215d2e1d09d5163a15 Signed-off-by: Ilho Kim --- tizen-database/database.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tizen-database/database.hpp b/tizen-database/database.hpp index b8e9b6c..c5f1f72 100644 --- a/tizen-database/database.hpp +++ b/tizen-database/database.hpp @@ -744,7 +744,7 @@ class Database { int r = sqlite3_prepare_v2(db_.get(), sql.GetQuery().c_str(), -1, &stmt, nullptr); if (r != SQLITE_OK) - return { nullptr, nullptr, "", true }; + return { nullptr, db_, "", true }; return { stmt, db_, sql.GetQuery(), false }; } @@ -756,7 +756,7 @@ class Database { int r = sqlite3_prepare_v2(db_.get(), sql.GetQuery().c_str(), -1, &stmt, nullptr); if (r != SQLITE_OK) { - return { nullptr, nullptr, "", true }; + return { nullptr, db_, "", true }; } std::unique_ptr stmt_auto(stmt, -- 2.7.4