gtpgcnn.h 687 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // Created by lloyd on 2020/10/14.
  3. //
  4. #ifndef GTCVR_GTPGCNN_H
  5. #define GTCVR_GTPGCNN_H
  6. #include "libpq-fe.h"
  7. class gtpgcnn {
  8. public:
  9. std::string cnnstr;
  10. private:
  11. PGconn *cnn;
  12. PGresult *res;
  13. /* std::mutex mtx;
  14. //0:init status;1: refrence status -1:already close
  15. int isalreadycloseres;*/
  16. public:
  17. gtpgcnn();
  18. void openCnn();
  19. bool closeCnn();
  20. bool readContent(std::string sql);
  21. bool writeContent(std::string sql);
  22. int getRowsNumFromResult();
  23. int getColsNumFromResult();
  24. std::string getValueFromResult(int row, int col);
  25. void clearRes();
  26. char *getValueFromResultChar(int row, int col);
  27. };
  28. #endif //GTCVR_GTPGCNN_H