error.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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
  19. init_error ( void )
  20. {
  21. if ( !errMsg ) {
  22. errMsg = (dbString *) G_malloc(sizeof(dbString));
  23. db_init_string (errMsg);
  24. }
  25. db_set_string ( errMsg, _("DBMI-MySQL driver error:\n") );
  26. }
  27. /* append error message */
  28. void
  29. append_error ( const char *msg )
  30. {
  31. db_append_string ( errMsg, (char *)msg);
  32. }
  33. void
  34. report_error ( void )
  35. {
  36. db_append_string ( errMsg, "\n");
  37. db_error ( db_get_string (errMsg) );
  38. }