From db567ad00bcf053d766d9ab7f49008f0295b592a Mon Sep 17 00:00:00 2001
From: Steven Murray <steven.murray@cern.ch>
Date: Tue, 31 May 2016 15:00:30 +0200
Subject: [PATCH] Simplified the public interface of SqliteConn

---
 catalogue/SqliteConn.cpp | 13 +------------
 catalogue/SqliteConn.hpp | 21 ++++++++-------------
 2 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/catalogue/SqliteConn.cpp b/catalogue/SqliteConn.cpp
index e0140f1f9a..13076cad19 100644
--- a/catalogue/SqliteConn.cpp
+++ b/catalogue/SqliteConn.cpp
@@ -85,7 +85,7 @@ DbStmt *SqliteConn::createStmt(const std::string &sql) {
 //------------------------------------------------------------------------------
 void SqliteConn::createCatalogueDatabaseSchema() {
   try {
-    enableForeignKeys();
+    execMultiLineNonQuery("PRAGMA foreign_keys = ON;");
     const RdbmsCatalogueSchema schema;
     execMultiLineNonQuery(schema.sql);
   } catch(exception::Exception &ex) {
@@ -93,17 +93,6 @@ void SqliteConn::createCatalogueDatabaseSchema() {
   }
 }
 
-//------------------------------------------------------------------------------
-// enableForeignKeys
-//------------------------------------------------------------------------------
-void SqliteConn::enableForeignKeys() {
-  try {
-    execMultiLineNonQuery("PRAGMA foreign_keys = ON;");
-  } catch(exception::Exception &ex) {
-    throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
-  }
-}
-
 //------------------------------------------------------------------------------
 // executeMultiLineNonQuery
 //------------------------------------------------------------------------------
diff --git a/catalogue/SqliteConn.hpp b/catalogue/SqliteConn.hpp
index daad70ef80..90387043f6 100644
--- a/catalogue/SqliteConn.hpp
+++ b/catalogue/SqliteConn.hpp
@@ -69,19 +69,6 @@ public:
    */
   void createCatalogueDatabaseSchema();
 
-  /**
-   * This is an SqliteConn specific method that enables foreign key constraints.
-   */
-  void enableForeignKeys();
-
-  /**
-   * This is an SqliteConn specific method that executes the specified
-   * multi-line non-query SQL statement.
-   *
-   * @param sql The SQL statement.
-   */
-  void execMultiLineNonQuery(const std::string &sql);
-
   /**
    * This ia an SqliteConn specific method that prints the database schema to
    * the specified output stream.
@@ -105,6 +92,14 @@ private:
    */
   sqlite3 *m_conn;
 
+  /**
+   * This is an SqliteConn specific method that executes the specified
+   * multi-line non-query SQL statement.
+   *
+   * @param sql The SQL statement.
+   */
+  void execMultiLineNonQuery(const std::string &sql);
+
 }; // class SqliteConn
 
 } // namespace catalogue
-- 
GitLab