You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
  1. #ifndef _SQLITE_base_class_h_
  2. #define _SQLITE_base_class_h_
  3. #include "../../components/base/basicTypes.h"
  4. #include "../../components/base/basicMutex.h"
  5. #include "../../components/base/basicLogCollection.h"
  6. //#include <mysql/mysql.h>
  7. #include <sqlite3.h>
  8. #ifdef DEBUG_EXTRA
  9. #define DEBUG_SQLITE_QUERIES
  10. #endif
  11. class SQLite_Connector{
  12. private:
  13. basicLogCollection * m_pLog;
  14. bool m_bIsConnected;
  15. basicMutex m_mAccessMutex;
  16. sqlite3 * m_pDBLink;
  17. sqlite3_stmt * m_pResult;
  18. //MYSQL_ROW m_pRow;
  19. char m_pDBName[MAX_PATH];
  20. int m_nFLAGS;
  21. bool m_bPersistentConnection;
  22. public:
  23. SQLite_Connector();
  24. SQLite_Connector( CSTR DBHost, CSTR DBUser, CSTR DBPassword, U16 Port = 3306 );
  25. SQLite_Connector( CSTR DBName, CSTR DBHost, CSTR DBUser, CSTR DBPassword, U16 Port = 3306 );
  26. //MySQL_Connector( char *LocalUnixSocket, char *DBUser, char* DBPassword );
  27. virtual ~SQLite_Connector();
  28. bool Connect( CSTR FileName, int AUX_FLAGS = SQLITE_OPEN_FULLMUTEX, bool Persistent = false );
  29. CSTR escapeString( CSTR str );
  30. CSTR escapeBinary( uint8_t *Data, uint32_t Size );
  31. bool isConnected( void ){ return m_bIsConnected; };
  32. uint64_t QueryID( CSTR QS );
  33. bool SilentQuery( CSTR QS );
  34. AAssoc * Query( CSTR QS, bool useCache = false );
  35. void deleteResult( AAssoc *&R );
  36. bool ReConnect( void );
  37. bool Disconnect( void );
  38. };
  39. void deleteResult( AAssoc *&ptr );
  40. //extern MySQL_Connector DBC;
  41. #endif