mysqli_result.cpp 486 B

12345678910111213141516171819202122232425262728
  1. #include "mysqli_result.h"
  2. #include "mysqli.h"
  3. mysqli_result::mysqli_result()
  4. {
  5. _result = nullptr;
  6. }
  7. mysqli_result::~mysqli_result()
  8. {
  9. free();
  10. }
  11. void mysqli_result::free()
  12. {
  13. if (_result != nullptr) {
  14. mysql_free_result(_result); // https://dev.mysql.com/doc/refman/5.7/en/mysql-free-result.html
  15. _result = nullptr;
  16. }
  17. return;
  18. }
  19. unsigned int mysqli_result::num_fields()
  20. {
  21. if (_result == nullptr) {
  22. mysqli::throw_null_reference_error();
  23. }
  24. return mysql_num_fields(_result);
  25. }