d_delete.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*!
  2. * \file db/dbmi_driver/d_delete.c
  3. *
  4. * \brief DBMI Library (driver) - delete record
  5. *
  6. * (C) 1999-2008 by the GRASS Development Team
  7. *
  8. * This program is free software under the GNU General Public
  9. * License (>=v2). Read the file COPYING that comes with GRASS
  10. * for details.
  11. *
  12. * \author Joel Jones (CERL/UIUC), Radim Blazek
  13. */
  14. #include <grass/dbmi.h>
  15. #include "macros.h"
  16. #include "dbstubs.h"
  17. /*!
  18. \brief Delete record (?)
  19. \return DB_OK on success
  20. \return DB_FAILED on failure
  21. */
  22. int db_d_delete(void)
  23. {
  24. dbToken token;
  25. dbCursor *cursor;
  26. int stat;
  27. /* get the arg(s) */
  28. DB_RECV_TOKEN(&token);
  29. cursor = (dbCursor *) db_find_token(token);
  30. if (cursor == NULL || !db_test_cursor_type_update(cursor)) {
  31. db_error("** not an update cursor **");
  32. DB_SEND_FAILURE();
  33. return DB_FAILED;
  34. }
  35. /* call the procedure */
  36. stat = db_driver_delete(cursor);
  37. /* send the return code */
  38. if (stat != DB_OK) {
  39. DB_SEND_FAILURE();
  40. return DB_OK;
  41. }
  42. DB_SEND_SUCCESS();
  43. /* no results */
  44. return DB_OK;
  45. }