CSqlite3DBProc.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef CSQLITE3DBPROC_H
  2. #define CSQLITE3DBPROC_H
  3. #ifndef SQLITE_HAS_CODEC
  4. #define SQLITE_HAS_CODEC
  5. #endif
  6. #include <string>
  7. #include "sqlite3.h"
  8. class CSqlite3DBProc
  9. {
  10. public:
  11. CSqlite3DBProc();
  12. ~CSqlite3DBProc();
  13. bool OpenDB(std::string sFile);
  14. bool CloseBD();
  15. bool ExcuteSql(std::string sSql);
  16. bool QuerySql(std::string sSql, sqlite3_stmt** m_stmt);
  17. bool BeginGetFields(sqlite3_stmt *m_stmt);
  18. bool Eof();
  19. bool Next(sqlite3_stmt *m_stmt);
  20. int GetFields(int nCol, int &nField, sqlite3_stmt *m_stmt);
  21. __int64 GetFields(int nCol, __int64 &nField, sqlite3_stmt *m_stmt);
  22. double GetFields(int nCol, double &fField, sqlite3_stmt *m_stmt);
  23. std::string GetFields(int nCol, std::string &sField, sqlite3_stmt *m_stmt);
  24. bool EndGetFields(sqlite3_stmt *m_stmt);
  25. bool BeginTransaction();
  26. bool CommitTransaction();
  27. bool RollbakTransaction();
  28. const std::string ErrMsg();
  29. private:
  30. sqlite3 *m_pDB;
  31. bool m_bIsEof;
  32. static const std::string m_sDBEncode;
  33. static const int m_nDBEncodeKeyNum;
  34. };
  35. extern std::shared_ptr<CSqlite3DBProc> g_DBProcPtr;
  36. extern std::shared_ptr<CSqlite3DBProc> g_sysDBProcPtr;
  37. #endif // CSQLITE3DBPROC_H