#ifndef COMPONENTS_SQLITE_PROTO_KEY_VALUE_TABLE_H_
#define COMPONENTS_SQLITE_PROTO_KEY_VALUE_TABLE_H_
#include <map>
#include <string>
#include <vector>
#include "base/memory/weak_ptr.h"
#include "sql/statement.h"
namespace google {
namespace protobuf {
class MessageLite;
}
}
namespace sqlite_proto {
namespace internal {
void BindDataToStatement(const std::string& key,
const google::protobuf::MessageLite& data,
sql::Statement* statement);
std::string GetSelectAllSql(const std::string& table_name);
std::string GetReplaceSql(const std::string& table_name);
std::string GetDeleteSql(const std::string& table_name);
std::string GetDeleteAllSql(const std::string& table_name);
}
template <typename T>
class KeyValueTable { … };
template <typename T>
KeyValueTable<T>::KeyValueTable(const std::string& table_name)
: … { … }
template <typename T>
void KeyValueTable<T>::GetAllData(std::map<std::string, T>* data_map,
sql::Database* db) const { … }
template <typename T>
void KeyValueTable<T>::UpdateData(const std::string& key,
const T& data,
sql::Database* db) { … }
template <typename T>
void KeyValueTable<T>::DeleteData(const std::vector<std::string>& keys,
sql::Database* db) { … }
template <typename T>
void KeyValueTable<T>::DeleteAllData(sql::Database* db) { … }
}
#endif