error.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**********************************************************
  2. * MODULE: mysql
  3. * AUTHOR(S): Radim Blazek (radim.blazek@gmail.com)
  4. * PURPOSE: MySQL database driver
  5. * COPYRIGHT: (C) 2001 by the GRASS Development Team
  6. * This program is free software under the
  7. * GNU General Public License (>=v2).
  8. * Read the file COPYING that comes with GRASS
  9. * for details.
  10. **********************************************************/
  11. #include <stdio.h>
  12. #include <grass/gis.h>
  13. #include <grass/dbmi.h>
  14. #include <grass/glocale.h>
  15. #include "globals.h"
  16. #include "proto.h"
  17. /* init error message */
  18. void init_error(void)
  19. {
  20. if (!errMsg) {
  21. errMsg = (dbString *) G_malloc(sizeof(dbString));
  22. db_init_string(errMsg);
  23. }
  24. db_set_string(errMsg, _("DBMI-MySQL driver error:\n"));
  25. }
  26. /* append error message */
  27. void append_error(const char *msg)
  28. {
  29. db_append_string(errMsg, (char *)msg);
  30. }
  31. void report_error(void)
  32. {
  33. db_append_string(errMsg, "\n");
  34. db_error(db_get_string(errMsg));
  35. }