From 65dc711e3da48ab78ff7071612a93217aaa07caa Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 13 Dec 2022 02:50:50 +0000 Subject: [PATCH] Add OneStepExec() method to tizen_base::Database To support calling the sqlite3_exec(), the method is added. Change-Id: I9e8023690302f4c99e13f180808d109b94708bee Signed-off-by: Hwankyu Jhun --- tizen-database/database.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tizen-database/database.hpp b/tizen-database/database.hpp index a75c644..32140b0 100644 --- a/tizen-database/database.hpp +++ b/tizen-database/database.hpp @@ -660,6 +660,16 @@ class Database { return true; } + void OneStepExec(const Sql& sql) const { + char* errmsg = nullptr; + int ret = sqlite3_exec(db_, sql.GetQuery().c_str(), nullptr, nullptr, + &errmsg); + if (ret != SQLITE_OK) { + std::unique_ptr errmsg_auto(errmsg, free); + throw DbException(errmsg); + } + } + private: void Bind(int pos, const DbType& type, sqlite3_stmt* stmt) const { int r; -- 2.7.4