Revert "Add functions required during db debug." 36/47536/4
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 4 Sep 2015 08:45:52 +0000 (10:45 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Tue, 15 Sep 2015 10:10:14 +0000 (03:10 -0700)
This reverts commit 4b4f7b9e045fadc3c5348e7ef8be628a742907e2.

Change-Id: Iac9f830b91a6ddfae1245a8b973ef51ed441738d

src/manager/dpl/db/include/dpl/db/sql_connection.h
src/manager/dpl/db/src/sql_connection.cpp
src/manager/service/db-crypto.cpp
src/manager/service/db-crypto.h

index 6b89a16..7c6e756 100644 (file)
@@ -386,17 +386,6 @@ class SqlConnection
          * @throw Exception::InvalidColumn
          */
         boost::optional<RawBuffer> GetColumnOptionalBlob(ColumnIndex column);
-
-        /**
-         * Get number of column.
-         */
-        ColumnIndex GetColumnCount();
-        /**
-         * Get type of the column.
-         *
-         * @throw Exception::InvalidColumn
-         */
-        int GetColumnType(ColumnIndex column);
     };
 
     // Move on copy constructor. No copy semantics
index 29b684e..20a01f2 100644 (file)
@@ -404,17 +404,6 @@ void SqlConnection::DataCommand::Reset()
     LogPedantic("SQL data command reset");
 }
 
-SqlConnection::ColumnIndex SqlConnection::DataCommand::GetColumnCount() {
-    return sqlcipher3_column_count(m_stmt);
-}
-
-int SqlConnection::DataCommand::GetColumnType(
-    SqlConnection::ColumnIndex column)
-{
-    CheckColumnIndex(column);
-    return sqlcipher3_column_type(m_stmt, column);
-}
-
 void SqlConnection::DataCommand::CheckColumnIndex(
     SqlConnection::ColumnIndex column)
 {
index ce9d750..8a5b57b 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include <fstream>
-#include <sstream>
 #include <db-crypto.h>
 #include <dpl/db/sql_connection.h>
 #include <dpl/log/log.h>
@@ -827,74 +826,6 @@ namespace DB {
 
         insertObjectCommand->Step();
     }
-
-    std::string Crypto::getSchema() {
-        SqlConnection::DataCommandUniquePtr schema =
-                m_connection->PrepareDataCommand("SELECT sql FROM "
-                        "(SELECT * FROM sqlcipher_master UNION ALL "
-                        "SELECT * FROM sqlcipher_temp_master) "
-                        "WHERE type!='meta' "
-                        "ORDER BY tbl_name, type DESC, name;");
-
-        std::stringstream ss;
-        while(schema->Step()) {
-            ss << schema->GetColumnString(0) << std::endl;
-        }
-        return ss.str();
-    }
-
-    std::string Crypto::getContent() {
-        SqlConnection::DataCommandUniquePtr tableSelect =
-                m_connection->PrepareDataCommand(
-                        "SELECT name FROM sqlcipher_master "
-                        "WHERE type IN ('table','view') AND name NOT LIKE 'sqlcipher_%' "
-                        "UNION ALL "
-                        "SELECT name FROM sqlcipher_temp_master "
-                        "WHERE type IN ('table','view') "
-                        "ORDER BY 1; ");
-
-        std::vector<std::string> tables;
-        while(tableSelect->Step()) {
-            tables.push_back(tableSelect->GetColumnString(0));
-        }
-
-        std::stringstream ss;
-
-        for (auto &e : tables) {
-            ss << "Table " << e << std::endl;
-            std::string query = "select * from " + e + ";";
-            SqlConnection::DataCommandUniquePtr result =
-                m_connection->PrepareDataCommand(query.c_str());
-            while(result->Step()) {
-                int maxColumn = result->GetColumnCount();
-                for (int i = 0; i < maxColumn; ++i) {
-                    switch(result->GetColumnType(i)) {
-                        case 1: // int64
-                            ss << result->GetColumnInteger(i) << " | ";
-                            break;
-                        case 2: // float
-                            ss << result->GetColumnFloat(i) << " | ";
-                            break;
-                        case 3: // string
-                            ss << result->GetColumnString(i) << " | ";
-                            break;
-                        case 4: // Blob
-                            {
-                            auto buffer = result->GetColumnBlob(i);
-                            ss << "BLOB (Size: " << buffer.size() << ") | ";
-                            break;
-                            }
-                        case 5: // NULL
-                            ss << "NULL | ";
-                            break;
-                    }
-                }
-                ss << std::endl;
-            }
-        }
-
-        return ss.str();
-    }
 } // namespace DB
 } // namespace CKM
 
index fca997c..c83b1e1 100644 (file)
@@ -115,10 +115,6 @@ namespace DB {
                     const Name &name,
                     const Label &ownerLabel);
 
-            std::string getSchema();
-
-            std::string getContent();
-
             // keys
             void saveKey(const Label& label, const RawBuffer &key);
             RawBufferOptional getKey(const Label& label);