30 lines
675 B
C
30 lines
675 B
C
|
#ifndef MYSQLUTILS_H
|
||
|
#define MYSQLUTILS_H
|
||
|
|
||
|
#include <string>
|
||
|
#include <mysql_connection.h>
|
||
|
#include <cppconn/driver.h>
|
||
|
#include <cppconn/exception.h>
|
||
|
#include <cppconn/resultset.h>
|
||
|
#include <cppconn/statement.h>
|
||
|
|
||
|
class MysqlUtils
|
||
|
{
|
||
|
protected:
|
||
|
MysqlUtils();
|
||
|
public:
|
||
|
~MysqlUtils();
|
||
|
|
||
|
static MysqlUtils* getInstance();
|
||
|
|
||
|
void CloseDatabase();
|
||
|
bool OpenDatabase(const std::string& server = "tcp://127.0.0.1:3306", int dbport = 3306, const std::string& dbuser = "root", const std::string& dbpasswd = "Hj57471000", const std::string& database="hjems");
|
||
|
|
||
|
|
||
|
private:
|
||
|
sql::Connection* m_pDbConnection;
|
||
|
static MysqlUtils m_instance;
|
||
|
};
|
||
|
|
||
|
#endif // MYSQLUTILS_H
|