d_bindupdate.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*!
  2. * \file db/dbmi_driver/d_bindupdate.c
  3. *
  4. * \brief DBMI Library (driver) - bind update
  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 ADD
  19. \return DB_OK on success
  20. \return DB_FAILED on failure
  21. */
  22. int db_d_bind_update()
  23. {
  24. dbToken token;
  25. dbCursor *cursor;
  26. int stat;
  27. int ncols;
  28. /* get the arg(s) */
  29. DB_RECV_TOKEN(&token);
  30. cursor = (dbCursor *) db_find_token(token);
  31. if (cursor == NULL || !db_test_cursor_type_update(cursor)) {
  32. db_error("** not an update cursor **");
  33. DB_SEND_FAILURE();
  34. return DB_FAILED;
  35. }
  36. DB_RECV_SHORT_ARRAY(&cursor->column_flags, &ncols);
  37. if (!db_test_cursor_any_column_flag(cursor)) {
  38. db_error("** no columns set in cursor for binding **");
  39. DB_SEND_FAILURE();
  40. return DB_FAILED;
  41. }
  42. /* call the procedure */
  43. stat = db_driver_bind_update(cursor);
  44. /* send the return code */
  45. if (stat != DB_OK) {
  46. DB_SEND_FAILURE();
  47. return DB_OK;
  48. }
  49. DB_SEND_SUCCESS();
  50. /* no results */
  51. return DB_OK;
  52. }