50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#ifndef DATAINTERFACE_DATAIMPORTER_H
|
|
#define DATAINTERFACE_DATAIMPORTER_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
|
|
namespace MySQL {
|
|
|
|
class MySQLClient;
|
|
|
|
} // namespace MySQL
|
|
|
|
namespace SQLite {
|
|
|
|
class SQLiteClient;
|
|
|
|
} // namespace SQLite
|
|
|
|
namespace DataStorageInterface {
|
|
namespace DataInterface {
|
|
|
|
class DataImporter
|
|
{
|
|
public:
|
|
DataImporter(MySQL::MySQLClient* pMySQLClient, SQLite::SQLiteClient* pSQLiteClient);
|
|
|
|
void ImportData();
|
|
|
|
private:
|
|
std::vector<std::string> GetTables();
|
|
std::vector<int> GetDevices(const std::string& table);
|
|
void ImportData(const std::string& table, int device);
|
|
|
|
int GetMaximumMySQLPacketSize();
|
|
int StringStreamSize(std::stringstream& ss);
|
|
void InitializeInsertQuery(std::stringstream& query);
|
|
void ExecuteInsertQuery(std::stringstream& query);
|
|
int GetMaximumTimestamp(const std::string& table, int device);
|
|
|
|
private:
|
|
MySQL::MySQLClient* m_pMySQLClient;
|
|
SQLite::SQLiteClient* m_pSQLiteClient;
|
|
};
|
|
|
|
} // namespace DataInterface
|
|
} // namespace DataStorageInterface
|
|
|
|
#endif // DATAINTERFACE_DATAIMPORTER_H
|