error.c 843 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*!
  2. \file db/driver/postgres/error.c
  3. \brief DBMI - Low Level PostgreSQL database driver - report errors
  4. This program is free software under the GNU General Public License
  5. (>=v2). Read the file COPYING that comes with GRASS for details.
  6. \author Radim Blazek
  7. */
  8. #include <stdio.h>
  9. #include <grass/gis.h>
  10. #include <grass/dbmi.h>
  11. #include <grass/glocale.h>
  12. #include "globals.h"
  13. /* init error message */
  14. void init_error(void)
  15. {
  16. if (!errMsg) {
  17. errMsg = (dbString *) G_malloc(sizeof(dbString));
  18. db_init_string(errMsg);
  19. }
  20. db_set_string(errMsg, _("DBMI-Postgres driver error:\n"));
  21. }
  22. /* append error message */
  23. void append_error(const char *msg)
  24. {
  25. db_append_string(errMsg, msg);
  26. }
  27. /* report error message */
  28. void report_error(void)
  29. {
  30. db_append_string(errMsg, "\n");
  31. db_error(db_get_string(errMsg));
  32. }