DataImporter.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef DATAINTERFACE_DATAIMPORTER_H
  2. #define DATAINTERFACE_DATAIMPORTER_H
  3. #include <string>
  4. #include <vector>
  5. namespace MySQL {
  6. class MySQLClient;
  7. } // namespace MySQL
  8. namespace SQLite {
  9. class SQLiteClient;
  10. } // namespace SQLite
  11. namespace DataStorageInterface {
  12. namespace DataInterface {
  13. class DataImporter
  14. {
  15. public:
  16. DataImporter(MySQL::MySQLClient* pMySQLClient, SQLite::SQLiteClient* pSQLiteClient);
  17. void ImportData();
  18. private:
  19. std::vector<std::string> GetTables();
  20. std::vector<int> GetDevices(const std::string& table);
  21. void ImportData(const std::string& table, int device);
  22. int GetMaximumMySQLPacketSize();
  23. int StringStreamSize(std::stringstream& ss);
  24. void InitializeInsertQuery(std::stringstream& query);
  25. void ExecuteInsertQuery(std::stringstream& query);
  26. int GetMaximumTimestamp(const std::string& table, int device);
  27. private:
  28. MySQL::MySQLClient* m_pMySQLClient;
  29. SQLite::SQLiteClient* m_pSQLiteClient;
  30. };
  31. } // namespace DataInterface
  32. } // namespace DataStorageInterface
  33. #endif // DATAINTERFACE_DATAIMPORTER_H