Remove unused sqlite functions 28/234628/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 27 May 2020 11:38:56 +0000 (20:38 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 27 May 2020 11:38:56 +0000 (20:38 +0900)
Change-Id: Id410f29556192f1f84dc0cf835e2dc39c9945176
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/theme_provider/sqlite_connection.cc
src/theme_provider/sqlite_connection.h
src/theme_provider/sqlite_statement.cc
src/theme_provider/sqlite_statement.h
src/theme_provider/sqlite_transaction.cc [deleted file]
src/theme_provider/sqlite_transaction.h [deleted file]

index 9ff3d90..8f046d9 100644 (file)
@@ -82,19 +82,6 @@ bool SQLiteConnection::Execute(const std::string& command) {
   return true;
 }
 
-bool SQLiteConnection::BeginTransaction() {
-  return Execute("BEGIN EXCLUSIVE");
-}
-
-bool SQLiteConnection::CommitTransaction() {
-  return Execute("COMMIT");
-}
-
-bool SQLiteConnection::RollbackTransaction() {
-  SetErrorCode(0);
-  return Execute("ROLLBACK");
-}
-
 std::string SQLiteConnection::GetErrorMessage() const {
   return sqlite3_errmsg(db_);
 }
index 3007979..51a875d 100644 (file)
@@ -41,10 +41,6 @@ class SQLiteConnection : public std::enable_shared_from_this<SQLiteConnection> {
   bool Disconnect();
   std::string GetErrorMessage() const;
 
-  bool BeginTransaction();
-  bool CommitTransaction();
-  bool RollbackTransaction();
-
   std::string path_;
   sqlite3* db_;
   int error_code_;
index 61a781d..5f091d5 100644 (file)
@@ -43,16 +43,6 @@ SQLiteStatement::StepResult SQLiteStatement::Step() {
   return res;
 }
 
-bool SQLiteStatement::BindInt(int pos, int val) {
-  int r = sqlite3_bind_int(stmt_, pos, val);
-  if (r != SQLITE_OK) {
-    LOG(ERROR) << "sqlite3_bind_int() failed: " << GetErrorMessage();
-    sql_conn_->SetErrorCode(r);
-    return false;
-  }
-  return true;
-}
-
 bool SQLiteStatement::BindString(int pos, const std::string& val) {
   int r = sqlite3_bind_text(stmt_, pos, val.c_str(), -1, SQLITE_TRANSIENT);
   if (r != SQLITE_OK) {
@@ -74,11 +64,6 @@ bool SQLiteStatement::BindBlob(int pos, const std::vector<unsigned char>& val) {
   return true;
 }
 
-int SQLiteStatement::GetColumnInt(int pos) const {
-  int val = sqlite3_column_int(stmt_, pos);
-  return val;
-}
-
 std::string SQLiteStatement::GetColumnString(int pos) const {
   const char* val = reinterpret_cast<const char*>(
       sqlite3_column_text(stmt_, pos));
@@ -100,19 +85,6 @@ std::vector<unsigned char> SQLiteStatement::GetColumnBlob(int pos) const {
   return std::vector<unsigned char>(val, val + len);
 }
 
-bool SQLiteStatement::Reset() {
-  int r = sqlite3_reset(stmt_);
-  if (r != SQLITE_OK) {
-    LOG(ERROR) << "sqlite3_reset failed: " << GetErrorMessage();
-    return false;
-  }
-  return true;
-}
-
-void SQLiteStatement::Clear() {
-  sqlite3_clear_bindings(stmt_);
-}
-
 std::string SQLiteStatement::GetErrorMessage() const {
   return sqlite3_errmsg(sqlite3_db_handle(stmt_));
 }
index 5517086..4ab6d70 100644 (file)
@@ -29,17 +29,12 @@ class SQLiteStatement {
   enum class StepResult : int { DONE, ROW, ERROR, };
   StepResult Step();
 
-  bool BindInt(int pos, int val);
   bool BindString(int pos, const std::string& val);
   bool BindBlob(int pos, const std::vector<unsigned char>& val);
 
-  int GetColumnInt(int pos) const;
   std::string GetColumnString(int pos) const;
   std::vector<unsigned char> GetColumnBlob(int pos) const;
 
-  bool Reset();
-  void Clear();
-
  private:
   std::string GetErrorMessage() const;
 
diff --git a/src/theme_provider/sqlite_transaction.cc b/src/theme_provider/sqlite_transaction.cc
deleted file mode 100644 (file)
index 0fb9bcf..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include "theme_provider/sqlite_transaction.h"
-
-#include "theme_provider/sqlite_connection.h"
-
-namespace ttm {
-namespace provider {
-
-void SQLiteTransaction::lock() const {
-  sql_conn_->BeginTransaction();
-}
-
-void SQLiteTransaction::unlock() const {
-  if (!sql_conn_->GetErrorCode())
-    sql_conn_->CommitTransaction();
-  else
-    sql_conn_->RollbackTransaction();
-}
-
-}  // namespace provider
-}  // namespace ttm
diff --git a/src/theme_provider/sqlite_transaction.h b/src/theme_provider/sqlite_transaction.h
deleted file mode 100644 (file)
index 5cb61c4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef THEME_PROVIDER_SQLITE_TRANSACTION_H_
-#define THEME_PROVIDER_SQLITE_TRANSACTION_H_
-
-namespace ttm {
-namespace provider {
-
-class SQLiteConnection;
-
-// BasicLockableClass.
-// usage:
-//  SQLiteTransaction t;
-//  std::lock_guard<SQLiteTransaction> guard(t);
-class SQLiteTransaction {
- public:
-  explicit SQLiteTransaction(SQLiteConnection* sql_conn)
-      : sql_conn_(sql_conn) { }
-  void lock() const;
-  void unlock() const;
-
- private:
-  SQLiteConnection* sql_conn_;
-};
-
-}  // namespace provider
-}  // namespace ttm
-
-#endif  // THEME_PROVIDER_SQLITE_TRANSACTION_H_